Skip to main content

Mojo struct

Naive2dConvolution

struct Naive2dConvolution[output_origin: MutOrigin, input_origin: ImmutOrigin, filter_origin: ImmutOrigin, //, output_type: DType, input_type: DType, filter_type: DType]

Struct wrapper for naive 2d convolution implementation.

Fields

  • output (UnsafePointer[Scalar[output_type], output_origin]):
  • input (UnsafePointer[Scalar[input_type], input_origin]):
  • filter (UnsafePointer[Scalar[filter_type], filter_origin]):
  • pad_d (IndexList[2]):
  • pad_h (IndexList[2]):
  • pad_w (IndexList[2]):
  • stride (IndexList[3]):
  • dilation (IndexList[3]):
  • num_groups (Int):
  • output_shape (IndexList[5]):
  • input_shape (IndexList[5]):
  • filter_shape (IndexList[5]):

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable

Methods

__init__

__init__(out self, output: UnsafePointer[Scalar[output_type], output_origin], input: UnsafePointer[Scalar[input_type], input_origin], filter: UnsafePointer[Scalar[filter_type], filter_origin], output_shape: IndexList[5], input_shape: IndexList[5], filter_shape: IndexList[5], pad_d: IndexList[2], pad_h: IndexList[2], pad_w: IndexList[2], stride: IndexList[3], dilation: IndexList[3], num_groups: Int)

run

static run(output: UnsafePointer[Scalar[output_type], output_origin], input: UnsafePointer[Scalar[input_type], input_origin], filter: UnsafePointer[Scalar[filter_type], filter_origin], output_shape: IndexList[5], input_shape: IndexList[5], filter_shape: IndexList[5], pad_d: IndexList[2], pad_h: IndexList[2], pad_w: IndexList[2], stride: IndexList[3], dilation: IndexList[3], num_groups: Int)

Was this page helpful?