關於pytorch中部分矩陣乘法的總結(torch.mm,torch.mul,torch.matmul)

1、torch.mul 該乘法可簡單理解爲矩陣各位相乘,一個常見的例子爲向量點乘,源碼定義爲torch.mul(input,other,out=None)。其中other能夠爲一個數也能夠爲一個張量,other爲數即張量的數乘。 該函數可觸發廣播機制(broadcast)。html tensor1 = 2*torch.ones(1,4) tensor2 = 3*torch.ones(4,1) pr
相關文章
相關標籤/搜索