Skip to main content

Mojo function

roi_align_nhwc

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

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): The pooling mode "AVG" for average and "MAX" for max pooling.

Was this page helpful?