Your first neural network
It's time for you to implement a small neural network containing two linear layers in sequence.
Latihan ini adalah bagian dari kursus
Introduction to Deep Learning with PyTorch
Petunjuk latihan
- Add a container for stacking layers in sequence.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
import torch
import torch.nn as nn
input_tensor = torch.Tensor([[2, 3, 6, 7, 9, 3, 2, 1]])
# Create a container for stacking linear layers
model = nn.____(nn.Linear(8, 4),
nn.Linear(4, 1)
)
output = model(input_tensor)
print(output)