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)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM