计算交叉熵时报错:
RuntimeError: multi-target not supported at /pytorch/aten/src/THCUNN/generic/ClassNLLCriterion.cu:15

维度不匹配导致
input, target的维度与F.cross_entropy()函数要求的维度不匹配

解决方法:

F.cross_entropy( input, target.squeeze() )
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐