mean函数

求平均值

th> a=torch.zeros(1,3)
                                                                      [0.0002s]
th> a
 0  0  0
[torch.DoubleTensor of size 1x3]

                                                                      [0.0003s]
th> a[{1,1}]=1
                                                                      [0.0001s]
th> a[{1,2}]=2
                                                                      [0.0001s]
th> a[{1,3}]=3
                                                                      [0.0000s]
th> a
 1  2  3
[torch.DoubleTensor of size 1x3]

                                                                      [0.0003s]
th> b=a:mean()
                                                                      [0.0001s]
th> b
2    
原文地址:https://www.cnblogs.com/ymjyqsx/p/6233133.html