3. CUDA semantics
2. Broadcasting semantics Broadcasting mechanism
The broadcast mechanism requires the first item to be aligned, and the first item can be broadcast after it is aligned (equal), or a certain first item is 1.
But if the two sizes are equal, the first item must be equal, even if one item is 1.
1. Autograd mechanics
x=torch.randn(5,5) y=torch.randn(5,5) z=torch.randn((5,5),requires_grad=True) a = x+ y a.requires_grad Out[135]: False b=a+z b.requires_grad Out[137]: True