IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo function

roi_align_nhwc

def roi_align_nhwc[dtype: DType, //, aligned: Bool, mode: StringSlice[StaticConstantOrigin] = StringSlice("AVG")](output: TileTensor[dtype, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type, element_size=output.element_size], input: TileTensor[dtype, Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type, element_size=input.element_size], rois: TileTensor[dtype, Storage=rois.Storage, address_space=rois.address_space, linear_idx_type=rois.linear_idx_type, element_size=rois.element_size], output_height: Int, output_width: Int, in_spatial_scale: Scalar, in_sampling_ratio: Scalar)

Compute ROIAlign a batch of rois of shape [M, 5] where the first dim is the batch index, followed by region box coordinates (y0, x0) (y1, x1). For inputs of NHWC format. The output shape is [M, output_height, output_width, C].

Parameters:

  • โ€‹dtype (DType): Type of the input tensor.
  • โ€‹aligned (Bool): If not true offset the ROIs by 0.5.
  • โ€‹mode (StringSlice[StaticConstantOrigin]): The pooling mode "AVG" for average and "MAX" for max pooling.