pytorch的matmul怎么广播

https://pytorch.org/docs/stable/notes/broadcasting.html#broadcasting-semantics

https://pytorch.org/docs/stable/torch.html?highlight=matmul#torch.matmul

# can line up trailing dimensions >>> x=torch.empty(5,3,4,1) >>> y=torch.empty( 3,1,1) # x and y are broadcastable. # 1st trailing dimension: both have size 1 # 2nd trailing dimension: y has size 1 # 3rd trailing dimension: x size == y size # 4th trailing dimension: y dimension doesn't exist

上一篇:numpy矩阵乘法中的multiply,matmul和dot


下一篇:numpy中matmul()、multiply()、dot()的区别