Hi!
I think the issue is with this line,



 Francisco_Obando:

        pred = torch.round(torch.sigmoid(torch.flatten(y_pred)))



I think the backward method for torch.round is 0  with respect to all inputs. So, for example,
x=torch.randn(10, requires_grad=True) #returns tensor([-0.0534,  1.1239, ...])
y=torch.round(x)                      #round these values
y.backward(torch.ones_like(y))        #calculate gradient of round(x) with respect to x
x.grad                                #returns tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])

And, given that this line happens after your network calculation, all the gradients of your weights/biases of your network are dependent on this line and therefore will have zero gradient! Perhaps pass in torch.sigmoid(torch.flatten(y_pred)) rather than the rounded value, and see if that works!