I’m not sure, how cumulative_rewards is being calculated, but it might be the computation graph is attached to it. If you store this tensor somehow or keep it alive, all computation graphs will be stores as well.
You could call detach() on it to detach it from the computation graph so that it can be freed.