midPyTorch
What is broadcasting in PyTorch?
Updated May 17, 2026
Short answer
Broadcasting allows operations on tensors of different shapes.
Deep explanation
PyTorch automatically expands smaller tensors to match larger ones without copying data.
Real-world example
Used in vectorized operations in deep learning.
Common mistakes
- Assuming actual memory expansion occurs.
Follow-up questions
- What are broadcasting rules?
- When does broadcasting fail?