Tensor Broadcasting Stride implementation | Broadcast Strides Explained | Make Your Own PyTorch #10
Byte यंत्र
0:00 / 0:00
Tensor Broadcasting Stride implementation | Broadcast Strides Explained | Make Your Own PyTorch #10
7 просмотров · 4 дн. назад
Byte यंत्र
1 подписчик
7 просмотров · 4 дн. назад
How does Tensor Broadcasting actually work inside a Tensor library? 🤯
In this video, we move from the theory of broadcasting to the actual implementation of broadcast stride calculation in JavaScript.
We implement the logic that determines what stride each input dimension should use when a tensor is broadcast to a target shape. The key idea is simple: dimensions that are broadcast need a stride of 0, while dimensions that are not broadcast keep their original stride.
Topics covered:
• Broadcast stride calculation
• Right-to-left shape alignment
• Handling missing dimensions
• Stride = 0 for broadcast dimensions
• Preserving original strides
• Broadcasting [3] to [2, 3]
• Broadcasting [2, 1, 3] to [2, 1, 3]
• Broadcasting [4, 1] to [4, 3]
• General broadcast stride algorithm
• JavaScript implementation
• Edge cases and practical examples
This is Episode 10 of the Make Your Own PyTorch series, where we build a PyTorch-like Tensor library from scratch using JavaScript and understand how tensor operations work internally.
#JavaScript #TensorBroadcasting #Broadcasting #Tensor #PyTorch #MachineLearning #DeepLearning #AI #TensorOperations #PyTorchFromScratch #MachineLearningFromScratch #DeepLearningFromScratch #JavaScriptProgramming #TensorLibrary #MakeYourOwnPyTorch