Hi,
you need to use with torch.no_grad(): in order not to store inner information used for backprop and to allow memory to be freed.
like:
with torch.no_grad():
      output = model(input)

It also may be desirable to use model.eval()