This question evaluates understanding of tensor shapes, linear layer forward computation, and deep-learning-framework broadcasting semantics. It is commonly asked to confirm practical ability to translate mathematical layer definitions into concrete tensor shapes and to reason about broadcasting behavior; it belongs to the Machine Learning domain and tests practical application of tensor algebra grounded in conceptual understanding.
You are given a standard MLP layer (fully connected layer) used in deep learning.
Assume:
x
has shape
(B, Din)
(batch size
B
).
Dout
.
Answer the following:
weight
and
bias
in
torch.nn.Linear(Din, Dout)
?
x
has shape
(B, T, Din)
(e.g., sequence length
T
)?
bias
add correctly?