Skip to main content
Log in

Mojo function

avg_pool_gpu

avg_pool_gpu[type: DType, int_type: DType, rank: Int = 4, count_boundary: Bool = False](ctx: DeviceContext, input: NDBuffer[type, rank, origin], filter: NDBuffer[int_type, 1, origin], strides: NDBuffer[int_type, 1, origin], dilations: NDBuffer[int_type, 1, origin], paddings: NDBuffer[int_type, 1, origin], output: NDBuffer[type, rank, origin], ceil_mode: Bool = False)

Computes the average pool on GPU.

Params: count_boundary: Whether to count the boundary in the average computation.

Args:

  • ctx (DeviceContext): The DeviceContext to use for GPU execution.
  • input (NDBuffer[type, rank, origin]): (On device) Batched image input to the pool2d operator.
  • filter (NDBuffer[int_type, 1, origin]): (On host) Filter size on height and width dimensions with assumed tuple def (filter_h, filter_w).
  • strides (NDBuffer[int_type, 1, origin]): (On host) Strides on height and width dimensions with assumed tuple def (stride_h, stride_w).
  • dilations (NDBuffer[int_type, 1, origin]): (On host) Dilations on height and width dimensions with assumed tuple def (dilation_h, dilation_w).
  • paddings (NDBuffer[int_type, 1, origin]): (On host) Paddings on height and width dimensions with assumed tuple def (pad_h_before, pad_h_after, pad_w_before, pad_w_after)).
  • output (NDBuffer[type, rank, origin]): (On device) Pre-allocated output tensor space.
  • ceil_mode (Bool): Ceiling mode defines the output shape and implicit padding.

Was this page helpful?