Перейти к содержимому

Sum & Mean Backward in Autograd | Make Your Own PyTorch #28

Byte यंत्र

0:00 / 0:00

Sum & Mean Backward in Autograd | Make Your Own PyTorch #28

7 просмотров · 11 дн. назад
Byte यंत्र
3 подписчика
7 просмотров · 11 дн. назад
How does Autograd calculate gradients for Sum and Mean operations? 🤔 In Episode 28 of Make Your Own PyTorch, we explain and implement the backward pass for reduction operations in our JavaScript-based Tensor library. During the forward pass, Sum adds elements along specified axes, while Mean calculates their average. But what happens during backpropagation? How do gradients return to the original tensor shape? In this video, we explore the mathematics behind both backward operations and implement the logic step by step. What you'll learn: How Sum backward calculates gradients How Mean backward distributes gradients across reduced elements Why gradients must be broadcast back to the input shape How reduction axes affect gradient calculation How keepdim = true and keepdim = false influence output shapes How to handle reductions across multiple axes Why Mean backward divides gradients by the number of reduced elements How to implement SumBackward and MeanBackward in JavaScript This is Episode 28 of the Make Your Own PyTorch series, where we build a PyTorch-like Tensor library from scratch using JavaScript and explore the internal mechanics of tensors, operations, and automatic differentiation. We're building our own Autograd engine one operation at a time, understanding the mathematics before relying on a framework. #Autograd #SumBackward #MeanBackward #PyTorch #Backpropagation #AutomaticDifferentiation #TensorOperations #Broadcasting #JavaScript #MachineLearning #DeepLearning #PyTorchFromScratch #CodingInHindi #ProgrammingInHindi #MakeYourOwnPyTorch