text_plain_output_1.png
import torch

t1 = torch.tensor(4.0)
t1

t2 = torch.tensor([1.0, 2, 3, 4])
t2

t3 = torch.tensor([[5.0, 6], [7, 8], [9, 10]])
t3

t4 = torch.tensor([[[11, 12, 13], [13, 14, 15]], [[15, 16, 17], [17, 18, 19.0]]])
t4

x = torch.tensor(3.0)
w = torch.tensor(4.0, requires_grad=True)
b = torch.tensor(5.0, requires_grad=True)

print('dy/dx:', x.grad)
print('dy/dw:', w.grad)
print('dy/db:', b.grad)