首页 > 其他分享 >RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimensio

RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimensio

时间:2023-01-16 18:33:21浏览次数:33  
标签:non tensor RuntimeError 图片 size png 通道

报错

RuntimeError:张量a的大小必须与张量b在非单例维度0上的大小匹配
换言之:通道数不同,本代码中使用png图片(四通道图片)
png图片比jpg多了一个Alpha通道, 一个RGB颜色模型的真彩图形,用由红、绿、蓝三个色彩信息通道合成的,每个通道用了8位色彩深度,共计24位,包含了所有彩色信息。为实现图形的透明效果,png图片采取在图形文件的处理与存储中附加上另一个8位信息的方法,这个附加的代表图形中各个素点透明度的通道信息就被叫做Alpha通道。

错误代码:

补救

结果:
tensor(0.0588)
tensor(-0.9412)

标签:non,tensor,RuntimeError,图片,size,png,通道
From: https://www.cnblogs.com/Ling-22/p/17056115.html

相关文章