Hi, when executing the following code, I have the error “Trying to backward through the graph a second time”. But when I remove the copy (and compute backward directly on y.mean() ) then it works. Is someone able to explain why the use of copy_ creates such an error ?

x=torch.randn(5,3)
m=nn.Linear(3,2)
store=torch.zeros(5,2)
y=m(x)
store.copy_(y)
store.mean().backward()
y=m(x)
store.copy_(y)
store.mean().backward() ==> ERROR