Solution Review: Setting Up a Computation Graph
Learn how we can set up a computation graph.
We'll cover the following...
Solution
Press + to interact
import torch# set up simple graph relating x, y and za = torch.tensor(3.0, requires_grad=True)b = torch.tensor(2.0, requires_grad=True)x = 3*a + 3*by = 6*a*a + 5*b*b*bz = 3*x + 3*yprint("a:", a)print("b:", b)print("x:", x)print("y:", y)print("z:", z)