Evaluate \(y = a^2 + b\) at \(a = 10\) and \(b = 20\).
Find \(\dv*{y}{a}\) and \(\dv*{y}{b}\) at said \(a\) and \(b\).
import tensorflow as tf
a = tf.constant(10.0)
b = tf.constant(20.0)
with tf.GradientTape() as tape:
tape.watch([a, b])
y = a ** 2 + b
da, db = tape.gradient(y, [a, b])
f"y = {y}, dy/da = {da}, dy/db = {db}"