I have written a simple sgd optimiser in 1.1.4 as:
class Optimiser():
    def __init__(self,params,lr):
        self.params=params
        self.lr=lr
    def step(self):
        for p in self.params: 
            p.data.add_(-self.lr, p.grad)   
    def zero_grad(self):
        for p in self.params:p.grad.zero_()

My train loop is :
sgd=Optimiser(model.parameters(),0.01)
for epoch in range(epochs):
    for i,data in enumerate(trainloader):
        xb = data[0]
        yb = data[1]
        pred = model(xb)
        loss = loss_func(pred, yb)
        loss.backward()
        sgd.step()
        sgd.zero_grad()

And the loss does not decrease at all. In fact I put a print statement in
def step(self):
        for p in self.params: 
            p.data.add_(-self.lr, p.grad)   
            print('Here')

And ‘Here’ was only printed in the first step and stopped being printed after than meaning somehow I stop entering the update params step. I don’t understand why this would happen.
If instead of opt.step() I call
for p in model.parameters():p.data.add_(-0.01, p.grad)
My model does start learning. So what is happening?