S
S
Stepan Sidorov2020-09-26 18:23:11
Neural networks
Stepan Sidorov, 2020-09-26 18:23:11

How to train a neural network model?

Hello.
Here I am writing a neural network with the PyTorch library.
I figured out how to create a model, and even how to pass a signal through layers :)
Here is the class code

class Net(nn.Module):
    def __init__(self):
        super(Net,self).__init__()
        self.layers = nn.Sequential(
            nn.Linear(in_features=1,out_features=10),
            nn.ReLU(),
            nn.Linear(in_features=10,out_features=5),
            nn.ReLU(),
            nn.Linear(in_features=5,out_features=1),
            nn.ReLU()
        )

    def forward(self, x):
        return self.layers(x)

But here's the problem, I can't find a simple learning solution :\
Function type torch.train() , or self.layer.train() (or rather, they are, but this is how I understood the stubs).

I want to find such a simple function.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan Sidorov, 2020-09-27
@always-prog

Hey!
Here is a good example of how the neural network is trained:
https://pytorch.org/tutorials/beginner/blitz/cifar...

D
dmshar, 2020-09-26
@dmshar

Recommended:
https://pytorch.org/assets/deep-learning/Deep-Lear...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question