ML TensorsWhat is a tensor? A multi-dimensional array that generalizes scalars, vectors, and matrices. What is a 0D tensor called? A scalar (e.g. 5) What is a 1D tensor called? A vector (e.g. [1, 2, 3]) What is a 2D tensor called? A matrix (e.g. [[1, 2],
What does a shape [16, 3, 5, 5] mean in a CNN?
16 filters, 3 input channels (RGB), each with a 5×5 kernel
What does the shape [3, 4] typically represent in a dense layer?
3 input features mapped to 4 output neurons (weight matrix)
What is a 2D tensor called?
A matrix (e.g. [[1, 2], [3, 4]])
What is a tensor?
A multi-dimensional array that generalizes scalars, vectors, and matrices.
What is a 0D tensor called?
A scalar (e.g. 5)
What is a 1D tensor called?
A vector (e.g. [1, 2, 3])
In deep learning, what type of data is usually stored as tensors?
Inputs, weights, biases, outputs, and gradients.
Are all tensors matrices?
No — only 2D tensors are matrices.
Why are tensors used in ML libraries like PyTorch or TensorFlow?
They're efficient for GPU computation and support automatic differentiation.
Are all matrices tensors?
Yes — all matrices are 2D tensors.
What is the shape of a tensor representing 2 samples, each with 3 features?
[2, 3] — a 2×3 matrix
What is the result of multiplying a tensor of shape [2, 3] by [3, 4]?
[2, 4] — 2 samples, 4 outputs each
What shape does a batch of 8 RGB images of size 32×32 have?
[8, 3, 32, 32] — batch size, channels, height, width
What is the shape of a 4D weight tensor in a convolutional layer?
[num_filters, in_channels, kernel_height, kernel_width]
What function multiplies two tensors (matrix multiplication)?
np.dot() in NumPy or torch.matmul() in PyTorch