Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Explain the purpose of the tf.function input_signature parameter.
Answer: The input_signature parameter in tf.function specifies the input signature of the function. It helps in static shape checking, allowing TensorFlow to optimize the function for a specific input signature.

Example:

@tf.function(input_signature=[tf.TensorSpec(shape=(None,), dtype=tf.float32)])
def my_function(x):
    return x * x

Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook