There wouldn’t be a reason why the gradient computation should influence the model without any updates as seen here:
model = nn.Linear(1, 1)
x = torch.randn(1, 1)

for _ in range(10):
    out = model(x)
    print(out)
    out.backward() # compute gradients