# Loss per batch is not decreasing, need help!

**URL:** <https://discuss.pytorch.org/t/loss-per-batch-is-not-decreasing-need-help/108037>\
**Category:** Uncategorized\
**Created:** [January 6, 2021, 4:18am UTC](https://discuss.pytorch.org/t/loss-per-batch-is-not-decreasing-need-help/108037 "2021-01-06T04:18:26Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![CedricLy](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/cedricly/32/30907_2.png) [@CedricLy](https://discuss.pytorch.org/u/CedricLy)\
**Post date:** [January 6, 2021, 9:50pm UTC](https://discuss.pytorch.org/t/loss-per-batch-is-not-decreasing-need-help/108037/8 "2021-01-06T21:50:11Z")

</div>

Hi can you try your code with the line:

optimizer=optim.SGD(model.fc.parameters(), lr=learning\_rate)  
The code seems totally legit and either this is the problem or one has to check the dataloader further.  
There is also the probability of this

```auto
model.fc = new_fc_layers

```

assignment needs to be done differently.  
For replacement check this out:  
[How to Replace a layer or Module in a pretrained network? - PyTorch Forums](https://discuss.pytorch.org/t/how-to-replace-a-layer-or-module-in-a-pretrained-network/60068)

---

_[View the full topic](https://discuss.pytorch.org/t/loss-per-batch-is-not-decreasing-need-help/108037)._
