0
点赞
收藏
分享

微信扫一扫

Torch nn.MM 实例

后来的六六 2022-08-08 阅读 150


​​https://github.com/torch/nn/blob/master/doc/simple.md#nn.MM​​

th> a = torch.ones(2,3) 
th> b = torch.ones(3,4)
th> nn.MM()({a,b})

3 3 3 3
3 3 3 3

th> a = torch.ones(1,2,3)
th> b = torch.ones(1,3,4)
th> nn.MM()({a,b})

(1,.,.) =
3 3 3 3
3 3 3 3

th> a = torch.ones(1,2) 
th> b = torch.ones(1,3)
th> nn.MM(true,false)({a,b})

1 1 1
1 1 1

th> a = torch.ones(2,2)
th> b = torch.ones(2,3)
th> nn.MM(true,false)({a,b})

2 2 2
2 2 2

th> a = torch.ones(5,2)
th> b = torch.ones(5,3)
th> nn.MM(true,false)({a,b})

5 5 5
5 5 5

th> a = torch.ones(5,4,1)
th> b = torch.ones(5,4,2)
th> nn.MM(true,false)({a,b})

(1,.,.) =
4 4

(2,.,.) =
4 4

(3,.,.) =
4 4

(4,.,.) =
4 4

(5,.,.) =
4 4
[torch.DoubleTensor of size 5x1x2]


举报

相关推荐

0 条评论