My goal is to export a model for fast inference.
When I trace a model with
jit.trace I usually do it this way:
model.eval() with torch.no_grad(): input = torch.rand(size=(1, 3, 500, 500)) traced_cell = torch.jit.trace(model.to("cpu"), (input))
It is not clear to me if
with torch.no_grad() are required (or still suggested) when exporting a model with