I would like a function such as 1 - x with autograd, but I come up with some questions about the difference between the following code.
x = 1.0 - nn.Parameter(torch.zeros(1, 3, 1, 1))
print(x)
y = torch.ones(1, 3, 1, 1) - nn.Parameter(torch.zeros(1, 3, 1, 1))
print(y)
z = - nn.Parameter(torch.zeros(1, 3, 1, 1)) + 1.0
print(z)

Output:
tensor([[[[1.]],

         [[1.]],

         [[1.]]]], grad_fn=<RsubBackward1>)
tensor([[[[1.]],

         [[1.]],

         [[1.]]]], grad_fn=<SubBackward0>)
tensor([[[[1.]],

         [[1.]],

         [[1.]]]], grad_fn=<AddBackward0>)

the <grad_fn> between them look different, but I dont konw how to test them to know the difference between them.
Someone have any idea ? Thanks a lot.