当前位置: 代码迷 >> 综合 >> pytorch中的mean,max操作
  详细解决方案

pytorch中的mean,max操作

热度:45   发布时间:2024-02-23 08:43:02.0
  1. x=torch.arange(15).view(5,3)

  2. x=x.float()

  3. x_mean=torch.mean(x,dim=0,keepdim=True)(表示每一列的平均数)

  4. x_mean0=torch.mean(x,dim=1,keepdim=True)(表示每一行的平均数)

  5. x_mean:6 7 8

  6.  
  7. x_mean0:

1

4

7

10

13

  相关解决方案