Thank you! It’s weird. I just change code like :

    #  torch.index_select(x1, 0, idx, out=xx1)
    #  torch.index_select(y1, 0, idx, out=yy1)
    #  torch.index_select(x2, 0, idx, out=xx2)
    #  torch.index_select(y2, 0, idx, out=yy2)
    xx1 = torch.index_select(x1, 0, idx)
    yy1 = torch.index_select(y1, 0, idx)
    xx2 = torch.index_select(x2, 0, idx)
    yy2 = torch.index_select(y2, 0, idx)


It is working!