Hi,
let x=torch.vstack((a,b)) and a is being optimized using autograd. How can we update the new value of x without using x=torch.vstack((a,b)) again, i.e. the new value of a will be updated automatically in x? (using shared memory or something like this)
Same question for nn.ZeroPad2d, torch.index_select, torch.cat,  torch.roll and in-place operation
PS: e.g. torch.flatten updates the values properly
Here an example:

import torch
import torch.optim as optim
x = torch.randn(3, 4,requires_grad=True)
y=torch.cat((x,x))
L = torch.randn(3, 4)
L[0,0]=x[0,0]
f=torch.flatten(x)
t=y.sum()
t.backward()
opt = optim.Adam([x], lr=0.1)
print(“x”,x)
print(“f”,f)
print(“y”,y)
print(“L”,L)
opt.step()
print("========================")
print("========================")
print(“x”,x)
print(“f”,f)
print(“y”,y)
print(“L”,L)

Thanks!