I think the issue is this line: sr_loss/len(train_X). I’m assuming that len(train_X) is a constant and sr_loss is defined to be 0 at the beginning of training.
But you don’t ever zero it out. It’s always being added onto. So it’s just getting larger and larger as time goes on, regardless of how training is going.