ptrblck:

print(input_identity)


how can i use nn.Identity() where it just return the input without any manipulation? What is the point of using it when i can’t achieve original input without influence of any subsequent manipulation? We can achieve this using clone () as below, what is the point of nn.Identity()?
a = torch.arange(4.)
input_identity = a.clone().detach()
print(a)
print(input_identity)

tensor([0., 1., 2., 3.])
tensor([0., 1., 2., 3.])

a[0] = 2.
print(a)
print(input_identity)

tensor([2., 1., 2., 3.])
tensor([0., 1., 2., 3.])