# Are there two valid Gradient Descent approaches in PyTorch?

**URL:** <https://discuss.pytorch.org/t/are-there-two-valid-gradient-descent-approaches-in-pytorch/214273>\
**Category:** Uncategorized\
**Created:** [December 16, 2024, 1:08pm UTC](https://discuss.pytorch.org/t/are-there-two-valid-gradient-descent-approaches-in-pytorch/214273 "2024-12-16T13:08:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![albanD](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alband/32/215_2.png) [@albanD](https://discuss.pytorch.org/u/albanD)\
**Post date:** [December 16, 2024, 4:07pm UTC](https://discuss.pytorch.org/t/are-there-two-valid-gradient-descent-approaches-in-pytorch/214273/2 "2024-12-16T16:07:25Z")

</div>

Yes they’re both the same (up to numerical precision) in the numerics.  
They will have different runtime/memory tradeoff though.  
See details here: [Why do we need to set the gradients manually to zero in pytorch? - #20 by albanD](https://discuss.pytorch.org/t/why-do-we-need-to-set-the-gradients-manually-to-zero-in-pytorch/4903/20)

---

_[View the full topic](https://discuss.pytorch.org/t/are-there-two-valid-gradient-descent-approaches-in-pytorch/214273)._
