Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> import torch
- >>> a = torch.tensor([2.0], requires_grad=True)
- >>> b = a * a
- >>> b
- tensor([4.], grad_fn=<MulBackward0>)
- >>> b.backward()
- >>> a.grad
- tensor([4.])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement