码迷,mamicode.com
首页 > 其他好文 > 详细

torch.expand()

时间:2020-02-26 20:51:58      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:int   nbsp   tar   print   targe   must   bsp   end   Dimension   

a=torch.rand(32,1)

a.expend(imgs.size())

>>>RuntimeError: The expanded size of the tensor (256) must match the existing size (32) at non-singleton dimension 2.  Target sizes: [32, 1, 256, 170].  Tensor sizes: [32, 1]

 

a=torch.rand(32,1,1,1)

a.expend(imgs.size())

print(a.size())

>>>(32,1,256,170)

torch.expand()

标签:int   nbsp   tar   print   targe   must   bsp   end   Dimension   

原文地址:https://www.cnblogs.com/JunzhaoLiang/p/12368733.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!