天天看点

arguments don‘t support automatic differentiation, but one of the argumentspytorch报错:Index_select(): functions with out=… arguments don’t support automatic differentiation

pytorch报错:Index_select(): functions with out=… arguments don’t support automatic differentiation

解决:

将注释的代码改为如下就不报错了,原因不清楚,有懂的大佬求指点

        # torch.index_select(x1, 0, idx, out=xx1)

        xx1 = torch.index_select(x1, 0, idx)

        # torch.index_select(y1, 0, idx, out=yy1)

        yy1 = torch.index_select(y1, 0, idx)

        # torch.index_select(x2, 0, idx, out=xx2)

        xx2 = torch.index_select(x2, 0, idx)

        # torch.index_select(y2, 0, idx, out=yy2)

        yy2 = torch.index_select(y2, 0, idx)

原因:感觉可能是api改了。