Skip to content
ml-recall

#reshape

5 questions from PyTorch, NumPy

Timed test

5 questions · 5 min · score and explanations at the end

Take a test
Q 1 / 5Score 0 / 0

Question 1: Short answer

mediumAI-checkedPyTorch

A character-level LSTM with batch_first=True and n_hidden = 256 processes a batch of 10 sequences of 50 characters over a vocabulary of 83 characters:

r_output, hidden = self.lstm(x, hidden)          # r_output: (10, 50, 256)
out = r_output.contiguous().view(-1, self.n_hidden)
out = self.fc(out)                               # fc = nn.Linear(256, 83)

What is the shape of out?

two numbers, e.g. (64, 10)