Optimizer on pytorch

hi guys,

I am new in Pytorch shifting from Keras am writting this simple code on pytorch but am getting an error when writting the optimizer part of the program. it keep saying parametre list is empty

How do you define your model?

It looks like no weights nor bias are initialize.

In the optimizer there is an input called model.parameters(). The name might fool you into beliving that it is something related to the parameters of the optimizer but it is actually the parameters or the weights of the network you defined. So you should define before the optimizer a network called model. For instance if you were to define your neural network using the name network then the optimizer would be called as
optimizer= torch.optim.SGD(network.parameters(), lr=0.01). Check here for a complete example: https://pytorch.org/tutorials/beginner/pytorch_with_examples.html#pytorch-optim

Be careful with __init__ method. Is not __init(self) but __init__(self).

THANKS VERY MUCH ITS WORKING BROH u just saved my ass there. I was about to turn around am happy doing things the Pythonic way.

Am very happy to be learning Pytorch
Thanks to the community