Shortcuts

mmcv.ops.point_sample

mmcv.ops.point_sample(input: torch.Tensor, points: torch.Tensor, align_corners: bool = False, **kwargs)torch.Tensor[source]

A wrapper around grid_sample() to support 3D point_coords tensors Unlike torch.nn.functional.grid_sample() it assumes point_coords to lie inside [0, 1] x [0, 1] square.

Parameters
  • input (torch.Tensor) – Feature map, shape (N, C, H, W).

  • points (torch.Tensor) – Image based absolute point coordinates (normalized), range [0, 1] x [0, 1], shape (N, P, 2) or (N, Hgrid, Wgrid, 2).

  • align_corners (bool, optional) – Whether align_corners. Default: False

Returns

Features of point on input, shape (N, C, P) or (N, C, Hgrid, Wgrid).

Return type

torch.Tensor