Ben Chuanlong Du's Blog

It is never too late to learn.

Ways to Enable and Disable Gradient in PyTorch

set_grad_enable

In [ ]:
with no_grad():
    pass

Module.train

Module.eval

In [ ]:
 

Comments