# Difference between eval(), torch.no\_grad() and with torch.set\_grad\_enabled()

**URL:** <https://discuss.pytorch.org/t/difference-between-eval-torch-no-grad-and-with-torch-set-grad-enabled/47022>\
**Category:** autograd\
**Created:** [June 4, 2019, 6:53am UTC](https://discuss.pytorch.org/t/difference-between-eval-torch-no-grad-and-with-torch-set-grad-enabled/47022 "2019-06-04T06:53:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![n0obcoder](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/n0obcoder/32/16606_2.png) [@n0obcoder](https://discuss.pytorch.org/u/n0obcoder)\
**Post date:** [June 4, 2019, 11:21am UTC](https://discuss.pytorch.org/t/difference-between-eval-torch-no-grad-and-with-torch-set-grad-enabled/47022/2 "2019-06-04T11:21:20Z")

</div>

> [@'model.eval()' vs 'with torch.no\_grad()'](https://discuss.pytorch.org/t/model-eval-vs-with-torch-no-grad/19615/29):
>
> are you saying that torch.no\_grad and torch.set\_grad\_enabled(False) are the same ?

---

_[View the full topic](https://discuss.pytorch.org/t/difference-between-eval-torch-no-grad-and-with-torch-set-grad-enabled/47022)._
