Memory management for variables stored during forward pass

Is there a difference in the way memory is allocated/freed using ctx.save_for_backward(x) vs ctx.x = x

Hi @Sushma_Rao, this thread covers your question.

It specifies ctx.x = x could lead to memory leak, and GPU memory exhausion.

3 Likes