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

avg_pool

def avg_pool[dtype: DType, int_type: DType, count_boundary: Bool = False, target: StringSlice[ImmStaticOrigin] = StringSlice("cpu")](input: TileTensor[dtype, Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type], filter: TileTensor[int_type, Storage=filter.Storage, address_space=filter.address_space, linear_idx_type=filter.linear_idx_type], strides: TileTensor[int_type, Storage=strides.Storage, address_space=strides.address_space, linear_idx_type=strides.linear_idx_type], dilations: TileTensor[int_type, Storage=dilations.Storage, address_space=dilations.address_space, linear_idx_type=dilations.linear_idx_type], paddings: TileTensor[int_type, Storage=paddings.Storage, address_space=paddings.address_space, linear_idx_type=paddings.linear_idx_type], output: TileTensor[dtype, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type], ceil_mode: Bool = False, ctx: Optional[DeviceContext] = None)

Dispatches the average pooling operation to the CPU or GPU backend based on the target.

Parameters:

  • ​dtype (DType): Data type of the input and output tensors.
  • ​int_type (DType): Data type of the filter, strides, dilations, and paddings tensors.
  • ​count_boundary (Bool): Whether to count the boundary in the average computation.
  • ​target (StringSlice[ImmStaticOrigin]): Execution target, either "cpu" or "gpu".

Args:

Was this page helpful?