Untitled

mail@pastecode.io avatar
unknown
python
a year ago
533 B
21
Indexable
Never
import torch 
import torch.nn as nn

n_in_neurons = 4
n_hidden_neurons_1 = 6
n_hidden_neurons_2 = 3
n_out_neurons = 1

net = nn.Sequential(
    nn.Linear(n_in_neurons, n_hidden_neurons_1),
    nn.Sigmoid(), 
    nn.Linear(n_hidden_neurons_1, n_hidden_neurons_2),
    nn.Tanh(), 
    nn.Linear(n_hidden_neurons_2, n_out_neurons), 
    nn.ReLU()
)

x = torch.rand(50, 4) # инициализируйте тензор
output = net(x)
print(output) # выведите результат прогонки тензора