What is out.shape?
x = torch.randn(32, 10) fc = nn.Linear(10, 5) out = fc(x)
- (32, 5)
- (5, 32)
- (32, 10)
- (10, 5)
nn.Linear maps the last dimension 10 -> 5 and keeps the batch dimension of 32.
Play AI & ML ▸
out.shape?x = torch.randn(32, 10) fc = nn.Linear(10, 5) out = fc(x)