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    

 

posted @ 2016-12-29 15:16  有梦就要去实现他  阅读(596)  评论(0)    收藏  举报