Skip to content

Convolution 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(...).

Forward convolution

tileops.ops.convolution.Conv1dFwdOp

__init__

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

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

Parameters:

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

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

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

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

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

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

  • groups (int, default: 1 ) –

    Manifest params.groups, int, default 1.

  • 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,
    weight,
    bias=None,
)

Apply the convolution. One call to this op's operator, nothing else.

Parameters:

  • input (Tensor) –

    Input tensor in the manifest's layout.

  • weight (Tensor) –

    Convolution weight.

  • bias (Optional[Tensor], default: None ) –

    Per-output-channel bias, or None.

Returns:

  • Tensor –

    The convolution result.

Raises:

  • ValueError –

    Dtypes or shapes disagree with the manifest. Raised from inside the operator, by _eager_forward.

tileops.ops.convolution.Conv2dFwdOp

__init__

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

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

Parameters:

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

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

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

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

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

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

  • groups (int, default: 1 ) –

    Manifest params.groups, int, default 1.

  • 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,
    weight,
    bias=None,
)

Apply the convolution. One call to this op's operator, nothing else.

Parameters:

  • input (Tensor) –

    Input tensor in the manifest's layout.

  • weight (Tensor) –

    Convolution weight.

  • bias (Optional[Tensor], default: None ) –

    Per-output-channel bias, or None.

Returns:

  • Tensor –

    The convolution result.

Raises:

  • ValueError –

    Dtypes or shapes disagree with the manifest. Raised from inside the operator, by _eager_forward.

tileops.ops.convolution.Conv3dFwdOp

__init__

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

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

Parameters:

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

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

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

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

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

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

  • groups (int, default: 1 ) –

    Manifest params.groups, int, default 1.

  • 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,
    weight,
    bias=None,
)

Apply the convolution. One call to this op's operator, nothing else.

Parameters:

  • input (Tensor) –

    Input tensor in the manifest's layout.

  • weight (Tensor) –

    Convolution weight.

  • bias (Optional[Tensor], default: None ) –

    Per-output-channel bias, or None.

Returns:

  • Tensor –

    The convolution result.

Raises:

  • ValueError –

    Dtypes or shapes disagree with the manifest. Raised from inside the operator, by _eager_forward.