NLP में सामान्य tensor shapes: input tokens (batch_size, sequence_length) integers हैं। Embeddings (batch_size, seq_len, model_dim) floats हैं। Attention weights (batch_size, num_heads, seq_len, seq_len) हैं। Output logits (batch_size, seq_len, vocab_size) हैं। इन shapes को समझना आपको बताता है कि वास्तव में क्या हो रहा है: attention tensor N×N है क्योंकि प्रत्येक token हर दूसरे token पर attend करता है।
मुख्य tensor operations: matmul (matrix multiplication — neural networks में core computation), reshape (data बदले बिना dimensions बदलना), transpose (dimensions swap करना), concat (एक dimension के साथ tensors जोड़ना), slice (subtensors निकालना), और broadcast (element-wise operations के लिए differently-shaped tensors को compatible बनाना)। Deep learning वास्तव में tensors पर लागू इन operations का एक sequence है।
Tensors GPUs पर compute किए जाते हैं क्योंकि tensor operations massively parallel हैं: दो matrices को multiply करने में लाखों स्वतंत्र multiply-add operations शामिल हैं जो simultaneously चल सकते हैं। यही कारण है कि GPU VRAM मायने रखता है — computation में शामिल सभी tensors GPU memory में रहने चाहिए। जब आप VRAM से बाहर हो जाते हैं, तो ऐसा इसलिए है क्योंकि सभी tensor sizes का योग (model weights + activations + gradients + optimizer states) capacity से अधिक है। Gradient checkpointing, mixed precision, और model sharding जैसी techniques सभी tensor memory manage करने के बारे में हैं।