Hello everyone, I’m new to pytorch and I’m having this problem, I have to iteratively perform additions of two tensors within a cycle
x_ = torch.zeros_like(x)

for i in range(my_range):
	x = do_something(x)
	x_ = x_ + x   #here is the problem
	x   = x  - x_   #here is the problem


Adding Tensors seems to occupy new memory on GPU at every iteration, I’m working with large data so my model fills all the GPU Memory immediately. Is there a way to avoid that?