IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

roi_align_shape

def roi_align_shape(input: T, rois: T, output_height: Int64, output_width: Int64, spatial_scale: Scalar, sampling_ratio: Scalar) -> IndexList[Int(4)]

Computes the output shape for the mo.roi_align graph op.

Args:

  • ​input (T): Rank-4 batched image input in NHWC format with shape (N, H, W, C).
  • ​rois (T): Rank-2 tensor of ROI box coordinates with shape (M, 5) where each row is (batch_idx, y0, x0, y1, x1).
  • ​output_height (Int64): Pooled output height, in elements.
  • ​output_width (Int64): Pooled output width, in elements.
  • ​spatial_scale (Scalar): Scale factor remapping ROI coordinates to input coordinates.
  • ​sampling_ratio (Scalar): Number of sampling points in the interpolation grid used to compute each pooled bin.

Returns:

IndexList[Int(4)]: The output shape (num_rois, output_height, output_width, channels).

Was this page helpful?