Hi, x is a 4-D tensor and y is a 2-D tensor， and i want to replace the value of x by corresponding value in y with x as index. Like the code I write below. Because x.shape[0] is so big, it will make my code be very slow, so I want to know whether some quick method to do this by some torch function. Thanks
index_array = x.clone().long()
for i in range(0,x.shape[0]):
    x[i] = y[i][index_array[i]]