tilelang.carver.template.conv

Classes

ConvTemplate

A template for convolution (Conv).

Module Contents

class tilelang.carver.template.conv.ConvTemplate

Bases: tilelang.carver.template.base.BaseTemplate

A template for convolution (Conv).

This class defines the computation for a matrix-matrix convolution with configurable parameters such as transposition, data types, and bias addition.

N

The number of input samples processed simultaneously in a batch.

Type:

int

C

The number of input feature maps.

Type:

int

H

The height of the input feature maps.

Type:

int

W

The width of the input feature maps.

Type:

int

F

The number of filters (kernels) applied, determining output depth.

Type:

int

K

The spatial dimensions of each convolutional filter.

Type:

int

S

The step size by which the kernel slides across the input.

Type:

int

D

The spacing between kernel elements, controlling receptive field expansion.

Type:

int

P

The number of pixels added to input borders to control output spatial dimensions.

Type:

int

in_dtype

Data type of input matrices.

Type:

str

out_dtype

Data type of output matrix.

Type:

str

accum_dtype

Data type used for accumulation.

Type:

str

with_bias

Whether to add a bias term.

Type:

bool

N: int
C: int
H: int
W: int
F: int
K: int
S: int
D: int
P: int
in_dtype: str = 'float16'
out_dtype: str = 'float16'
accum_dtype: str = 'float16'
with_bias: bool = False
get_hardware_aware_configs(arch=None, topk=10)

Retrieves optimized hardware-aware configurations.

参数:
  • arch (TileDevice, optional) -- The target hardware architecture.

  • topk (int, optional) -- Number of top configurations to consider.

返回:

A list of optimization hints for hardware acceleration.

返回类型:

List[Hint]

initialize_function()

Defines and initializes the convolution computation.

This method sets up placeholders for input matrices, computes the convolution using TVM's compute API, and optionally applies bias and type casting.

抛出:

AssertionError -- If N, C, H, W, F, K, S, D, P are not positive integers.

返回类型:

None

params_as_dict()

Returns the template parameters as a dictionary.

返回:

Dictionary containing template parameter values.

返回类型:

dict

property class_attributes

Returns the class attributes in dictionary form.

返回:

Dictionary of class attributes.

返回类型:

dict

__repr__()

Returns a string representation of the class instance.

返回:

A formatted string representation of the class.

返回类型:

str