Skip to content Skip to sidebar Skip to footer

Tf.GradientTape() Return None

I'm trying to calculate the gradient with tf.GradientTape. When I try to do it using as inputs the loss and Model.variables (tf.keras.Model) the result that returns me in an array

Solution 1:

I assume you're using TensorFlow eager execution, an't you? If I'm not mistaken, under tf.GradientTape(), You should call the method that computes your model instead of calling one of its member. This computation execution will allow t to figure out which gradients it needs to generate later. I hope this helps


Post a Comment for "Tf.GradientTape() Return None"