'Tensorflow autodiff with respect to matrix entry
In the following code, the Jacobian I get is None. Why is that?
a1 = tf.constant(2.0)
a2 = tf.constant(1.5)
with tf.GradientTape(persistent=True) as tape:
tape.watch(a1)
tape.watch(a2)
A = tf.Variable([[a1, 0.0], [0.0, a2]])
y = tf.linalg.solve(A, x)
dy_da1 = tape.jacobian(y, a1)
dy_da1.numpy()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
