# Regularization on a subset of parameters

**URL:** <https://discuss.pytorch.org/t/regularization-on-a-subset-of-parameters/47801>\
**Category:** Uncategorized\
**Created:** [June 12, 2019, 10:39pm UTC](https://discuss.pytorch.org/t/regularization-on-a-subset-of-parameters/47801 "2019-06-12T22:39:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hosseinshn](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/h/9e8a1a/32.png) [@hosseinshn](https://discuss.pytorch.org/u/hosseinshn)\
**Post date:** [June 12, 2019, 10:39pm UTC](https://discuss.pytorch.org/t/regularization-on-a-subset-of-parameters/47801/1 "2019-06-12T22:39:47Z")

</div>

Hello,

I was wondering, what is the best way to apply L2 or L1 regularization to only some of the parameters of a network instead of all of them? For example, for a network with 3 fully connected layers.

Thanks,

Hossein

---

<div class="post-metadata">

**Author:** ![alex.veuthey](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alex.veuthey/32/12176_2.png) [@alex.veuthey](https://discuss.pytorch.org/u/alex.veuthey)\
**Post date:** [June 13, 2019, 6:17am UTC](https://discuss.pytorch.org/t/regularization-on-a-subset-of-parameters/47801/2 "2019-06-13T06:17:12Z")

</div>

Have a look at this topic / answer: [Don't Regularize Me, Bro](https://discuss.pytorch.org/t/dont-regularize-me-bro/4946/4)
