torch.expand()

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)

posted @ 2020-02-26 20:03  Junzhao  阅读(2620)  评论(0编辑  收藏  举报