con torch.no_grad () si condición
with torch.set_grad_enabled(not no_grad_condition):
out=network(input)
Bored Coder
with torch.set_grad_enabled(not no_grad_condition):
out=network(input)