PyTorch Broadcasting
This is very confusing, but very important to understand.
Resources
- PyTorch broadcasting link
Example
torch.randn(4,1) + torch.randn(1,4)Under the hood, it’s expanded
b = torch.randn(4,1)
b.expand(4,4).stride() # (1,0)This is very confusing, but very important to understand.
Resources
Example
torch.randn(4,1) + torch.randn(1,4)Under the hood, it’s expanded
b = torch.randn(4,1)
b.expand(4,4).stride() # (1,0)