Skip to content

Instantly share code, notes, and snippets.

@osbm
Created November 20, 2022 11:38
Show Gist options
  • Save osbm/c56db8d313e25bfb24f5f72144872076 to your computer and use it in GitHub Desktop.
Save osbm/c56db8d313e25bfb24f5f72144872076 to your computer and use it in GitHub Desktop.
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # stfu tensorflow
import tensorflow as tf
x = tf.constant(3.0)
print(x)
with tf.GradientTape() as tape:
tape.watch(x)
y = x * x
dy_dx = tape.gradient(y, x)
print(dy_dx)
@osbm
Copy link
Author

osbm commented Nov 20, 2022

Suppress tensorflow warnings and example usage of tf.GradienTape

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment