I am a newer to the pytorch. And i want repeat the experiment of a paper.
That is, I want to implement like this:
for input x
h = x
h[:,:,1:,:]=weight[:,:,1:,:]*h[:,:,:-1,:]+(1-weight[:,:,1:,:])*h[:,:,1:,:]
this would cause a runtime error: a leaf Variable that requires grad has been used in an in-place operation.
I have made some other alternatives，such as o = copy.deepcopy(x), but all not work. Any one can help me?