RuntimeError: The size of tensor a (96) must match the size of tensor b (7) at non-singleton dim2

运行时错误:张量a(96)的大小必须与张量b(7)在非单例dim2处的大小匹配

我是感觉我的理论shape计算没问题

结果问题出在

result = result.permute(0,2,1)#(B,L,C)=》(B,C,L)

result = self.dct_layer(result)#加入dct模块,mse降低0.12个点

result.permute(0,2,1)#(B,C,L)=》(B,L,C)

把第三行代码改成result=result.permute(0,2,1)就可以了,原来是没赋值,这种只permute一下,并不改变内存地址中的值

被自己无语到了

猜你喜欢

转载自blog.csdn.net/weixin_43332715/article/details/127742939