# Implementation of a Keras model doesn't converge

**URL:** <https://discuss.pytorch.org/t/implementation-of-a-keras-model-doesnt-converge/79446>\
**Category:** Uncategorized\
**Created:** [May 2, 2020, 6:25pm UTC](https://discuss.pytorch.org/t/implementation-of-a-keras-model-doesnt-converge/79446 "2020-05-02T18:25:19Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [May 3, 2020, 3:50am UTC](https://discuss.pytorch.org/t/implementation-of-a-keras-model-doesnt-converge/79446/8 "2020-05-03T03:50:15Z")

</div>

> [@Nbooo](#):
>
> As I understood, in Pytorch we need to set `weight_decay` parameter in our optimizer to achieve the same result, but I’m far from being confident here.

The `weight_decay` might be too aggressive in PyTorch, as it’ll add all parameters to the regularization term.  
Have a look at [this post](https://discuss.pytorch.org/t/weight-decay-in-the-optimizers-is-a-bad-idea-especially-with-batchnorm/16994/3) to exclude batch norm params etc. (or just add the conv parameters to the regularization).

---

_[View the full topic](https://discuss.pytorch.org/t/implementation-of-a-keras-model-doesnt-converge/79446)._
