I am taking inplace operation error from this code:

def rotate(origin, point, angle):
“”"
Rotate a point counterclockwise by a given angle around a given origin.
    The angle should be given in radians.
    """
    ox, oy = origin
    px, py = point

    qx = ox + math.cos(angle) * (px - ox) - math.sin(angle) * (py - oy)
    qy = oy + math.sin(angle) * (px - ox) + math.cos(angle) * (py - oy)
    #return torch.cat([qx, qy])
    return [qx, qy]



def rotate_traj_with_target_ped(x_seq, angle, PedsList_seq, lookup_seq):
origin = (0, 0)
vectorized_x_seq = x_seq.clone()
for ind, frame in enumerate(x_seq):
for ped in PedsList_seq[ind]:
point = frame[lookup_seq[ped], 0:2]
vectorized_x_seq[ind][lookup_seq[ped], 0] = rotate(origin, point, angle)[0]
#vectorized_x_seq[ind][lookup_seq[ped], 0] = rotated_points[0]
#vectorized_x_seq[ind][lookup_seq[ped], 1] = rotated_points[1]
#return vectorized_x_seq

I am getting this error the last line of uncommented code.Here is the error:

image.png878×270 64.3 KB

Even I changed the line like this:

vectorized_x_seq[0][0, 0] = 5]
I am getting exactly same error.Thanks for your helps.