torch.bmm()
生活随笔
收集整理的這篇文章主要介紹了
torch.bmm()
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 函數介紹
- 例子
函數介紹
torch.bmm(input, mat2, *, out=None) → Tensor-
輸入:
- input (Tensor) – the first batch of matrices to be multiplied
- mat2 (Tensor) – the second batch of matrices to be multiplied
-
函數在 input 和 mat2 之間進行 batch 矩陣乘法
-
input 和 mat2 都必須是 3-D tensors,他們包含的矩陣數量相同
-
如果 input 是 shape 為 [b, n, m] 的 tensor
-
mat2 是 shape 為 [b, m, p] 的 tensor
-
那么函數的結果就是 shape 為 [b, n, p] 的 tensor
-
例子
>>> input = torch.randn(10, 3, 4) >>> mat2 = torch.randn(10, 4, 5) >>> res = torch.bmm(input, mat2) >>> res.size() torch.Size([10, 3, 5])總結
以上是生活随笔為你收集整理的torch.bmm()的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mybatis中count(*)与cou
- 下一篇: 线性回归实战---Abalone鲍鱼年龄