Deeploy.TilingExtension.TilingCodegen.HyperRectangle
- class Deeploy.TilingExtension.TilingCodegen.HyperRectangle(offset: Tuple[int, ...], dims: Tuple[int, ...])
Bases:
objectRepresents a multi-dimensional rectangular region in tensor space.
A HyperRectangle defines a rectangular tile or region within a multi-dimensional tensor, specified by its position (offset) and dimensions (size) in each axis. This is fundamental for tiled processing of tensors where operations are performed on smaller rectangular chunks.
- Variables:
offset (Tuple[int, ...]) – Position of the hyperrectangle in feature map space. Each element represents the starting index along the corresponding dimension.
dims (Tuple[int, ...]) – Size of the hyperrectangle along each dimension. Each element represents the extent of the rectangle in the corresponding dimension.
- Parameters:
offset (Tuple[int, ...]) – Starting position of the rectangle in multi-dimensional space.
dims (Tuple[int, ...]) – Dimensions/size of the rectangle in multi-dimensional space.
- Raises:
AssertionError – If the offset and dims tuples have different lengths.
Notes
The offset and dims must have the same rank (number of dimensions). This ensures the hyperrectangle is well-defined in the tensor space.
Examples
>>> rect = HyperRectangle((0, 5), (10, 15)) >>> # Creates a 2D rectangle starting at (0,5) with size 10x15
Methods
- __init__(offset: Tuple[int, ...], dims: Tuple[int, ...])
Initialize a HyperRectangle with given offset and dimensions.
- Parameters:
offset (Tuple[int, ...]) – Starting position of the rectangle in multi-dimensional space.
dims (Tuple[int, ...]) – Dimensions/size of the rectangle in multi-dimensional space.
- Raises:
AssertionError – If offset and dims have mismatching dimensions.
__init__(offset, dims)Initialize a HyperRectangle with given offset and dimensions.
Attributes
offsetdims