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