def normalize_coords_grid(coords):
    """ normalize the coordinates to [-1,1]

    Args:
        coords: BxKxHxWx2
    """
    coords=coords.clone()
    B,K,H,W,_ = coords.shape

    coords[...,0] = 2*coords[...,0]/(W-1)-1
    coords[...,1] = 2*coords[...,1]/(H-1)-1

    return coords