# Update a weight after 15 epoch

**URL:** <https://discuss.pytorch.org/t/update-a-weight-after-15-epoch/128316>\
**Category:** audio\
**Created:** [August 2, 2021, 10:25am UTC](https://discuss.pytorch.org/t/update-a-weight-after-15-epoch/128316 "2021-08-02T10:25:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kuldeep\_Rana](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/kuldeep_rana/32/40861_2.png) [@Kuldeep\_Rana](https://discuss.pytorch.org/u/Kuldeep_Rana)\
**Post date:** [August 2, 2021, 10:25am UTC](https://discuss.pytorch.org/t/update-a-weight-after-15-epoch/128316/1 "2021-08-02T10:25:16Z")

</div>

Dear Sir/Madam,  
I am a beginner at the pytorch. I have occurred a problem. I want to update the weight after 15 epoch and keep the same weight till the end of training. How can I do this? Thank you very much.

---

<div class="post-metadata">

**Author:** ![Samuel\_Bachorik](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/samuel_bachorik/32/56232_2.png) [@Samuel\_Bachorik](https://discuss.pytorch.org/u/Samuel_Bachorik)\
**Post date:** [August 2, 2021, 12:38pm UTC](https://discuss.pytorch.org/t/update-a-weight-after-15-epoch/128316/2 "2021-08-02T12:38:28Z")

</div>

Show code and tell what you mean

EDIT: Or simply make if statement and after your 15th epoch dont call  
`optimizer.zero_grad() loss.backward() optimizer.step()`
