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 struct

ConvTransposedPacked

struct ConvTransposedPacked[input_linear_idx_type: DType, input_storage: TensorStorage, filter_linear_idx_type: DType, filter_storage: TensorStorage, output_linear_idx_type: DType, output_storage: TensorStorage, InputLayoutType: TensorLayout, FilterLayoutType: TensorLayout, OutputLayoutType: TensorLayout, conv_attr_rank: Int, //, input_origin: ImmOrigin, filter_origin: ImmOrigin, output_origin: MutOrigin, input_type: DType, filter_type: DType, output_type: DType, conv_attr: ConvInfoStatic[conv_attr_rank], elementwise_epilogue: Optional[def[rank: Int](coords: IndexList[rank], f_size: Int) capturing thin -> None] = None]

Holds the packed tensors and partition state for one task of a direct transposed convolution.

Encapsulates the output, input, and packed filter tile tensors along with the convolution shape and the partition assigned to a single parallel task, and drives the tiled batch, channel, and feature loops that accumulate the result.

Parameters​

  • ​input_linear_idx_type (DType): Linear index dtype of the input tensor (inferred).
  • ​input_storage (TensorStorage): Storage backing the input tile tensor (inferred).
  • ​filter_linear_idx_type (DType): Linear index dtype of the filter tensor (inferred).
  • ​filter_storage (TensorStorage): Storage backing the filter tile tensor (inferred).
  • ​output_linear_idx_type (DType): Linear index dtype of the output tensor (inferred).
  • ​output_storage (TensorStorage): Storage backing the output tile tensor (inferred).
  • ​InputLayoutType (TensorLayout): Compile-time layout of the input tensor (inferred).
  • ​FilterLayoutType (TensorLayout): Compile-time layout of the filter tensor (inferred).
  • ​OutputLayoutType (TensorLayout): Compile-time layout of the output tensor (inferred).
  • ​conv_attr_rank (Int): Number of spatial dimensions in the convolution (inferred).
  • ​input_origin (ImmOrigin): Immutable memory origin of the input tile tensor.
  • ​filter_origin (ImmOrigin): Immutable memory origin of the filter tile tensor.
  • ​output_origin (MutOrigin): Mutable memory origin of the output tile tensor.
  • ​input_type (DType): Element type of the input tensor.
  • ​filter_type (DType): Element type of the filter tensor.
  • ​output_type (DType): Element type of the output tensor.
  • ​conv_attr (ConvInfoStatic[conv_attr_rank]): Static convolution attributes carrying strides, pads, dilations, and group count.
  • ​elementwise_epilogue (Optional[def[rank: Int](coords: IndexList[rank], f_size: Int) capturing thin -> None]): Optional elementwise epilogue applied to the output after accumulation (defaults to None).

Fields​

  • ​output (TileTensor[output_type, OutputLayoutType, output_origin, Storage=output_storage, linear_idx_type=output_linear_idx_type]):
  • ​input (TileTensor[input_type, InputLayoutType, input_origin, Storage=input_storage, linear_idx_type=input_linear_idx_type]):
  • ​filter (TileTensor[filter_type, FilterLayoutType, filter_origin, Storage=filter_storage, linear_idx_type=filter_linear_idx_type]):
  • ​conv_shape (ConvShape[conv_attr_rank]):
  • ​partition (ConvPartition):
  • ​cf_tile_size (IndexList[Int(2)]):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable

Methods​

run​

static def run(output: TileTensor[output_type, OutputLayoutType, output_origin, Storage=output_storage, linear_idx_type=output_linear_idx_type], input: TileTensor[input_type, InputLayoutType, input_origin, Storage=input_storage, linear_idx_type=input_linear_idx_type], filter: TileTensor[filter_type, FilterLayoutType, filter_origin, Storage=filter_storage, linear_idx_type=filter_linear_idx_type], conv_shape: ConvShape[conv_attr_rank], ctx: Optional[DeviceContext] = None)

input_space_loop​

def input_space_loop[micro_kernel_height: Int, micro_kernel_width: Int, has_residual: Bool, last_c_tile: Bool](self, n: Int, f_tile_offset: Int, f_tile_size: Int, c_tile_offset: Int, c_tile_size: Int)

input_space_loop_2d​

def input_space_loop_2d[output_dt: DType, input_dt: DType, filter_dt: DType, //, micro_kernel_height: Int, micro_kernel_width: Int, has_residual: Bool, last_c_tile: Bool](self, output: Pointer[Scalar[output_dt], _safe=False], input: Pointer[Scalar[input_dt], _safe=False], filter: Pointer[Scalar[filter_dt], _safe=False], n: Int, first_c_tile_in_group: Bool, c_tile_size: Int, f_tile_offset: Int, f_tile_size: Int, left_pad_impact_end: Int, right_pad_impact_start: Int)

input_space_loop_3d​

def input_space_loop_3d[micro_kernel_height: Int, micro_kernel_width: Int, has_residual: Bool, last_c_tile: Bool, output_dt: DType, input_dt: DType, filter_dt: DType](self, output: Pointer[Scalar[output_dt], _safe=False], input: Pointer[Scalar[input_dt], _safe=False], filter: Pointer[Scalar[filter_dt], _safe=False], n: Int, first_c_tile_in_group: Bool, c_tile_size: Int, f_tile_offset: Int, f_tile_size: Int, left_pad_impact_end: Int, right_pad_impact_start: Int)

apply_epilogue​

def apply_epilogue(self, n: Int, g: Int)

Was this page helpful?