Hi,

Assume below is my code:

x = Variable(torch.ones(2, 2), requires_grad=True)

y = x + 2

z = y * y * 3

out = z.mean()

out.backward(retain_graph=True)

x,y,z,out = 0,0,0,0

Will the graph be freed up (deleted) at this point?

Thanks

Hi,

Assume below is my code:

x = Variable(torch.ones(2, 2), requires_grad=True)

y = x + 2

z = y * y * 3

out = z.mean()

out.backward(retain_graph=True)

x,y,z,out = 0,0,0,0

Will the graph be freed up (deleted) at this point?

Thanks

yes it will be freed.