Skip to main content
Log in

Mojo function

pool_shape_impl

pool_shape_impl[input_rank: Int, input_type: DType, filter_type: DType, strides_type: DType, dilations_type: DType, paddings_type: DType, single_thread_blocking_override: Bool, ceil_mode: Bool](input_buf: NDBuffer[input_type, input_rank, origin], filter_buf: NDBuffer[filter_type, 1, origin], strides_buf: NDBuffer[strides_type, 1, origin], dilations_buf: NDBuffer[dilations_type, 1, origin], paddings_buf: NDBuffer[paddings_type, 1, origin]) -> IndexList[input_rank]

Compute the output shape of a pooling operation, and assert the inputs are compatible. Works for 2D pool operations only in the NHWC format.

Parameters:

  • input_rank (Int): Rank of the input tensor.
  • input_type (DType): Type of the input tensor.
  • filter_type (DType): Type of the filter tensor.
  • strides_type (DType): Type of the strides tensor.
  • dilations_type (DType): Type of the dilations tensor.
  • paddings_type (DType): Type of the paddings tensor.
  • single_thread_blocking_override (Bool): If True, then the operation is run synchronously using a single thread.
  • ceil_mode (Bool): Define rounding mode for shape calculation.

Args:

  • input_buf (NDBuffer[input_type, input_rank, origin]): The input tensor.
  • filter_buf (NDBuffer[filter_type, 1, origin]): The filter size buffer.
  • strides_buf (NDBuffer[strides_type, 1, origin]): The strides size buffer.
  • dilations_buf (NDBuffer[dilations_type, 1, origin]): The dilations size buffer.
  • paddings_buf (NDBuffer[paddings_type, 1, origin]): The paddings size buffer.

Returns:

The output shape.