Repeated use of GradientTape for multiple Jacobian calculations
问题 I am attempting to compute the Jacobian of a TensorFlow neural network's outputs with respect to its inputs. This is easily achieved with the tf.GradientTape.jacobian method. The trivial example provided in the TensorFlow documentation is as follows: with tf.GradientTape() as g: x = tf.constant([1.0, 2.0]) g.watch(x) y = x * x jacobian = g.jacobian(y, x) This is fine if I want only want to compute the Jacobian of a single instance of the input tensor x . However, I need to repeatedly evaluate