Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Ways to Enable and Disable Gradient in PyTorch

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

set_grad_enable

with no_grad():
    pass

Module.train

Module.eval