45. Your First Neural Network in PyTorch
45.1 Build a Tiny Sequential Net
45.1 Tiny Sequential net बनावा
Chapters 41–44 एकत्र: चालणारा tiny net.
हे का शिकायचं?
Why. Chapters 41–44 एकत्र करा: PyTorch मध्ये चालणारा tiny net.
हे काय आहे?
What. torch.nn.Sequential layers stack करते. 3 features असलेल्या table साठी → hidden 8 → output 1 (sigmoid आधी binary score).
कसं करायचं?
How.
Module बनावा
- torch आणि torch.nn as nn import करा.
- Sequential: Linear → ReLU → Linear.
- Module print करा.
import torch
import torch.nn as nn
model = nn.Sequential(
nn.Linear(3, 8),
nn.ReLU(),
nn.Linear(8, 1),
)
print(model)
x = torch.randn(4, 3) # batch of 4
print(model(x).shape) # (4, 1)
Output / जे दिसायला हवं. Layer list आणि output shape (4, 1).