天天看點

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改了。