# Custom Optimizer

**URL:** <https://discuss.ai.google.dev/t/custom-optimizer/23684>\
**Category:** General Discussion\
**Tags:** docs, help\_dev, keras, api\
**Created:** [October 7, 2022, 10:35pm UTC](https://discuss.ai.google.dev/t/custom-optimizer/23684 "2022-10-07T22:35:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuele\_Bortolato](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/samuele_bortolato/32/9905_2.png) [@Samuele\_Bortolato](https://discuss.ai.google.dev/u/Samuele_Bortolato)\
**Post date:** [October 7, 2022, 10:35pm UTC](https://discuss.ai.google.dev/t/custom-optimizer/23684/1 "2022-10-07T22:35:40Z")

</div>

Hi, I’m trying to write a custom optimizer, but the official documentation doesn’t say much

> **[tf.keras.Optimizer  |  TensorFlow v2.16.1](https://www.tensorflow.org/api_docs/python/tf/keras/Optimizer)**
>
> A class for Tensorflow specific optimizer logic.

I don’t quite get how I’m supposed to use the slots and update the variables. I was able to find some external _tutorial_ but they either were old (refer to some different version of the optimizer class) or were not clear.

Does anybody know where to find a decent explaination of how to do it without having to reverse engineer the class? Thanks in advance

---

<div class="post-metadata">

**Author:** ![Bhack](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/bhack/32/6388_2.png) [@Bhack](https://discuss.ai.google.dev/u/Bhack)\
**Post date:** [October 8, 2022, 12:52pm UTC](https://discuss.ai.google.dev/t/custom-optimizer/23684/2 "2022-10-08T12:52:10Z")

</div>

You can find many custom optimizers at:

> **[addons/tensorflow\_addons/optimizers at master · tensorflow/addons](https://github.com/tensorflow/addons/tree/master/tensorflow_addons/optimizers)**
>
> Useful extra functionality for TensorFlow 2.x maintained by SIG-addons - tensorflow/addons

Please note that there will be a refactoring for the next release (TF 2.11):  
[https://github.com/tensorflow/addons/pull/2766](https://github.com/tensorflow/addons/pull/2766)
