当前位置: 首页 > 工具软件 > cdist > 使用案例 >

RuntimeError: cdist only supports 2D tensors, X1 got: 3D

孟光耀
2023-12-01

RuntimeError: cdist only supports 2D tensors, X1 got: 3D

报错信息:RuntimeError: cdist only supports 2D tensors, X1 got: 3D
在使用torch.cdist()时报以上错误信息,具体程序是dist=torch.cdist(x.unsqueeze(0), x.unsqueeze(0)).squeeze(0),当时使用的pytorch版本是1.1,最后换用1.3版本程序正常运行。具体原因目前还没有找到,有同样问题的可以尝试换一下版本。

 类似资料: