Skip to content

Pooling Operators

Every op on this page is used the same way: construct it once, then call it. The constructor takes what the kernel is compiled with; the call takes the tensors. Both are documented under each op — __init__ and forward, where forward is what runs when you call op(...).

Average pooling

tileops.ops.pool.AvgPool1dFwdOp

Average pooling over PyTorch-compatible NCL inputs.

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    ceil_mode=False,
    count_include_pad=True,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int]) –

    Manifest params.kernel_size, int | tuple[int].

  • stride (Optional[int | Tuple[int]], default: None ) –

    Manifest params.stride, int | tuple[int] | None, default None.

  • padding (int | Tuple[int], default: 0 ) –

    Manifest params.padding, int | tuple[int], default 0.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • count_include_pad (bool, default: True ) –

    Manifest params.count_include_pad, bool, default True.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on input.

tileops.ops.pool.AvgPool2dFwdOp

Average pooling over PyTorch-compatible NCHW inputs.

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    ceil_mode=False,
    count_include_pad=True,
    divisor_override=None,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int, int]) –

    Manifest params.kernel_size, int | tuple[int, int].

  • stride (Optional[int | Tuple[int, int]], default: None ) –

    Manifest params.stride, int | tuple[int, int] | None, default None.

  • padding (int | Tuple[int, int], default: 0 ) –

    Manifest params.padding, int | tuple[int, int], default 0.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • count_include_pad (bool, default: True ) –

    Manifest params.count_include_pad, bool, default True.

  • divisor_override (Optional[int], default: None ) –

    Manifest params.divisor_override, int | None, default None.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on input.

tileops.ops.pool.AvgPool3dFwdOp

Average pooling over PyTorch-compatible NCDHW inputs.

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    ceil_mode=False,
    count_include_pad=True,
    divisor_override=None,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int, int, int]) –

    Manifest params.kernel_size, int | tuple[int, int, int].

  • stride (Optional[int | Tuple[int, int, int]], default: None ) –

    Manifest params.stride, int | tuple[int, int, int] | None, default None.

  • padding (int | Tuple[int, int, int], default: 0 ) –

    Manifest params.padding, int | tuple[int, int, int], default 0.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • count_include_pad (bool, default: True ) –

    Manifest params.count_include_pad, bool, default True.

  • divisor_override (Optional[int], default: None ) –

    Manifest params.divisor_override, int | None, default None.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on input.

Max pooling

tileops.ops.pool.MaxPool1dFwdOp

Max pooling over PyTorch-compatible NCL inputs (return_indices=False).

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    dilation=1,
    ceil_mode=False,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int]) –

    Manifest params.kernel_size, int | tuple[int].

  • stride (Optional[int | Tuple[int]], default: None ) –

    Manifest params.stride, int | tuple[int] | None, default None.

  • padding (int | Tuple[int], default: 0 ) –

    Manifest params.padding, int | tuple[int], default 0.

  • dilation (int | Tuple[int], default: 1 ) –

    Manifest params.dilation, int | tuple[int], default 1.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on input.

tileops.ops.pool.MaxPool1dIndicesFwdOp

Max pooling over PyTorch-compatible NCL inputs (return_indices=True).

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    dilation=1,
    ceil_mode=False,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int]) –

    Manifest params.kernel_size, int | tuple[int].

  • stride (Optional[int | Tuple[int]], default: None ) –

    Manifest params.stride, int | tuple[int] | None, default None.

  • padding (int | Tuple[int], default: 0 ) –

    Manifest params.padding, int | tuple[int], default 0.

  • dilation (int | Tuple[int], default: 1 ) –

    Manifest params.dilation, int | tuple[int], default 1.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on the inputs the manifest declares.

Parameters:

  • input (Tensor) –

    Input tensor, dtype float16 | bfloat16 | float32.

Returns:

  • Tuple[Tensor, Tensor] –

    output, indices, as the manifest declares.

tileops.ops.pool.MaxPool2dFwdOp

Max pooling over PyTorch-compatible NCHW inputs (return_indices=False).

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    dilation=1,
    ceil_mode=False,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int, int]) –

    Manifest params.kernel_size, int | tuple[int, int].

  • stride (Optional[int | Tuple[int, int]], default: None ) –

    Manifest params.stride, int | tuple[int, int] | None, default None.

  • padding (int | Tuple[int, int], default: 0 ) –

    Manifest params.padding, int | tuple[int, int], default 0.

  • dilation (int | Tuple[int, int], default: 1 ) –

    Manifest params.dilation, int | tuple[int, int], default 1.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on input.

tileops.ops.pool.MaxPool2dIndicesFwdOp

Max pooling over PyTorch-compatible NCHW inputs (return_indices=True).

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    dilation=1,
    ceil_mode=False,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int, int]) –

    Manifest params.kernel_size, int | tuple[int, int].

  • stride (Optional[int | Tuple[int, int]], default: None ) –

    Manifest params.stride, int | tuple[int, int] | None, default None.

  • padding (int | Tuple[int, int], default: 0 ) –

    Manifest params.padding, int | tuple[int, int], default 0.

  • dilation (int | Tuple[int, int], default: 1 ) –

    Manifest params.dilation, int | tuple[int, int], default 1.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on the inputs the manifest declares.

Parameters:

  • input (Tensor) –

    Input tensor, dtype float16 | bfloat16 | float32.

Returns:

  • Tuple[Tensor, Tensor] –

    output, indices, as the manifest declares.

tileops.ops.pool.MaxPool3dFwdOp

Max pooling over PyTorch-compatible NCDHW inputs (return_indices=False).

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    dilation=1,
    ceil_mode=False,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int, int, int]) –

    Manifest params.kernel_size, int | tuple[int, int, int].

  • stride (Optional[int | Tuple[int, int, int]], default: None ) –

    Manifest params.stride, int | tuple[int, int, int] | None, default None.

  • padding (int | Tuple[int, int, int], default: 0 ) –

    Manifest params.padding, int | tuple[int, int, int], default 0.

  • dilation (int | Tuple[int, int, int], default: 1 ) –

    Manifest params.dilation, int | tuple[int, int, int], default 1.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on input.

tileops.ops.pool.MaxPool3dIndicesFwdOp

Max pooling over PyTorch-compatible NCDHW inputs (return_indices=True).

__init__

__init__(
    kernel_size,
    stride=None,
    padding=0,
    dilation=1,
    ceil_mode=False,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • kernel_size (int | Tuple[int, int, int]) –

    Manifest params.kernel_size, int | tuple[int, int, int].

  • stride (Optional[int | Tuple[int, int, int]], default: None ) –

    Manifest params.stride, int | tuple[int, int, int] | None, default None.

  • padding (int | Tuple[int, int, int], default: 0 ) –

    Manifest params.padding, int | tuple[int, int, int], default 0.

  • dilation (int | Tuple[int, int, int], default: 1 ) –

    Manifest params.dilation, int | tuple[int, int, int], default 1.

  • ceil_mode (bool, default: False ) –

    Manifest params.ceil_mode, bool, default False.

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on the inputs the manifest declares.

Parameters:

  • input (Tensor) –

    Input tensor, dtype float16 | bfloat16 | float32.

Returns:

  • Tuple[Tensor, Tensor] –

    output, indices, as the manifest declares.

Adaptive pooling

tileops.ops.pool.AdaptiveAvgPool2dFwdOp

Adaptive average pooling over PyTorch-compatible CHW/NCHW inputs.

__init__

__init__(
    output_size,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • output_size (int | None | Tuple[Optional[int], Optional[int]]) –

    Manifest params.output_size, int | None | tuple[int | None, int | None] | list[int | None].

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on input.

tileops.ops.pool.AdaptiveMaxPool2dFwdOp

Adaptive max pooling over CHW/NCHW inputs (return_indices=False).

__init__

__init__(
    output_size,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • output_size (int | None | Tuple[Optional[int], Optional[int]]) –

    Manifest params.output_size, int | None | tuple[int | None, int | None] | list[int | None].

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on input.

tileops.ops.pool.AdaptiveMaxPool2dIndicesFwdOp

Adaptive max pooling over CHW/NCHW inputs (return_indices=True).

__init__

__init__(
    output_size,
    *,
    target=None,
    tune=False
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • output_size (int | None | Tuple[Optional[int], Optional[int]]) –

    Manifest params.output_size, int | None | tuple[int | None, int | None] | list[int | None].

  • target (Target, default: None ) –

    Backend target to serve this op, or None to decide from the input device.

  • tune (bool, default: False ) –

    Whether to autotune, applied when a kernel is first built.

forward

forward(
    input,
)

Run the op on the inputs the manifest declares.

Parameters:

  • input (Tensor) –

    Input tensor, dtype float16 | bfloat16.

Returns:

  • Tuple[Tensor, Tensor] –

    output, indices, as the manifest declares.