Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is the purpose of the tf.GradientTape in TensorFlow?
Answer: tf.GradientTape is used for automatic differentiation in TensorFlow. It records operations for computing gradients, allowing you to calculate gradients with respect to variables.

Example:

x = tf.constant(3.0)
with tf.GradientTape() as tape:
    tape.watch(x)
    y = x * x
dy_dx = tape.gradient(y, x)

Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook