I am creating a 1D tensor like this:
t = torch.ones(4)
so t is:
tensor([1., 1., 1., 1.])
now I want to change the values of these tensor with a step so I can get a tensor like:
tensor([1., -1., 1., -1.])
How come this:
t[1:-1:2] = -1
produces this:
tensor([ 1., -1., 1., 1.]) ?