$ ./guess_the_languageAI & ML
AI & ML · medium · #26

What is out.shape?

x = torch.randn(32, 10)
fc = nn.Linear(10, 5)
out = fc(x)
  1. (32, 5)
  2. (5, 32)
  3. (32, 10)
  4. (10, 5)
nn.Linear maps the last dimension 10 -> 5 and keeps the batch dimension of 32.
Play AI & ML ▸