Gradients, Backprop, and Derivatives in Tensorflow [Draft]
Finding the gradient of f(x,y)=cosx∗siny+xyf(x,y) = \cos{x}*\sin{y} + \frac{x}{y} Using Numpy, Autograd, and Tensorflow In [76]: #Dependencies import tensorflow as tf from mpl_toolkits import mplot3d import numpy as np import matplotlib.pyplot as plt %matplotlib inline In [126]: import autograd.numpy as np # Thinly wrapped version of numpy from autograd import grad def f(x, y): return np.
Finding the gradient of f(x,y)=cosx∗siny+xyf(x,y) = \cos{x}*\sin{y} + \frac{x}{y} Using Numpy, Autograd, and Tensorflow In [76]: #Dependencies import tensorflow as tf from mpl_toolkits import mplot3d import numpy as np import matplotlib.pyplot as plt %matplotlib inline In [126]: import autograd.numpy as np # Thinly wrapped version of numpy from autograd import grad def f(x, y): return np.sin(np.sqrt(x ** 2 + y ** 2)) f_grad = grad(f) # magic: returns a function that computes the gradient of f x = 2. y = 0. print (f(x, y)) print (f_grad(x, y)) 0.9092974268256817…
related reading
- Differentiable Programming from Scratchthenumb.at
- Yes you should understand backprop | by Andrej Karpathy | Mediumkarpathy.medium.com
- Reverse-mode automatic differentiation from scratch, in Python | sidsitesidsite.com
- Calculus on Computational Graphs: Backpropagation -- colah's blogcolah.github.io
- Neural networks and deep learningneuralnetworksanddeeplearning.com
- Learning PyTorch with Examples — PyTorch Tutorials 2.12.0+cu130 documentationpytorch.org
- Understanding the Neural Tangent Kernel – EigenTaleseigentales.com
- Part 3: Intro to Policy Optimization - Spinning Up documentationspinningup.openai.com
- CS231n Deep Learning for Computer Visioncs231n.github.io
- CS231n Deep Learning for Computer Visioncs231n.github.io
- Some Math behind Neural Tangent Kernel | Lil'Loglilianweng.github.io
- Lecture 7 - Deep Learning Foundations: Neural Tangent Kernelsyoutube.com