错误通常报在loss.backward这一句。反向传播的时候,函数torch.cdist(x1,x2)需要为连续,如果有这个错说明X1(X2)的参数不连续,只要在这个参数后面加上.contiguous()就可以了。也就是如果报的是requires X1 to be contiguous那么只要找出torch.cdist,并改成
torch.cdist(x1.contiguous(),x2)就可以了
如何处理RuntimeError: _cdist_backward requires X1(X2) to be contiguous
于 2022-07-30 09:51:30 首次发布