# Regarding implementation of optimization algorithm

**URL:** <https://discuss.pytorch.org/t/regarding-implementation-of-optimization-algorithm/20920>\
**Category:** Uncategorized\
**Created:** [July 9, 2018, 5:11pm UTC](https://discuss.pytorch.org/t/regarding-implementation-of-optimization-algorithm/20920 "2018-07-09T17:11:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirito](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/kirito/32/5553_2.png) [@kirito](https://discuss.pytorch.org/u/kirito)\
**Post date:** [July 9, 2018, 5:11pm UTC](https://discuss.pytorch.org/t/regarding-implementation-of-optimization-algorithm/20920/1 "2018-07-09T17:11:25Z")

</div>

Hello, I am working on a new optimization algorithm but I am unable to integrate it in my pytorch code. Is there any way to implement any optimization algorithm other than present in the torch.optim package? Thanks a lot in advance.

---

<div class="post-metadata">

**Author:** ![Latope2-150](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/l/ed8c4c/32.png) [@Latope2-150](https://discuss.pytorch.org/u/Latope2-150)\
**Post date:** [July 9, 2018, 5:41pm UTC](https://discuss.pytorch.org/t/regarding-implementation-of-optimization-algorithm/20920/2 "2018-07-09T17:41:49Z")

</div>

Yes, you can just check the implementations of the optimization algorithms of pytorch (e.g. [SGD](https://pytorch.org/docs/stable/_modules/torch/optim/sgd.html#SGD) or [Adam](https://pytorch.org/docs/stable/_modules/torch/optim/adam.html#Adam)) and use them as a model to help you get started.  
Here is an example of an optimization algorithm that was presented at ICLR: [AccSGD](https://github.com/rahulkidambi/AccSGD/blob/master/AccSGD.py)

---

<div class="post-metadata">

**Author:** ![kirito](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/kirito/32/5553_2.png) [@kirito](https://discuss.pytorch.org/u/kirito)\
**Post date:** [July 9, 2018, 6:02pm UTC](https://discuss.pytorch.org/t/regarding-implementation-of-optimization-algorithm/20920/3 "2018-07-09T18:02:29Z")

</div>

Thanks a lot for your help.
