import torch from torch.autograd import Variable tensor = torch.FloatTensor([[1, 2], [3, 4]]) variable = Variable(tensor, requires_grad=True) print(tensor) # tensor([[1., 2.], [3., 4.]]) print(variable) # tensor([[1., 2.], [3., 4.]], requires_grad=Tr…