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

ConvShape

struct ConvShape[rank: Int]

A shape struct describing the convolution dimensions.

Fields​

  • ​n (Int):
  • ​input_dims (IndexList[rank]):
  • ​output_dims (IndexList[rank]):
  • ​filter_dims (IndexList[rank]):
  • ​c (Int):
  • ​f (Int):
  • ​stride (IndexList[rank]):
  • ​dilation (IndexList[rank]):
  • ​pad_d (IndexList[2]):
  • ​pad_h (IndexList[2]):
  • ​pad_w (IndexList[2]):
  • ​num_groups (Int):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable, RegisterPassable, TrivialRegisterPassable

Methods​

d​

def d(self) -> Int

Input depth.

Returns:

Int

h​

def h(self) -> Int

Input height.

Returns:

Int

w​

def w(self) -> Int

Input width.

Returns:

Int

do​

def do(self) -> Int

Output depth.

Returns:

Int

ho​

def ho(self) -> Int

Output height.

Returns:

Int

wo​

def wo(self) -> Int

Output width.

Returns:

Int

q​

def q(self) -> Int

Filter window depth.

Returns:

Int

r​

def r(self) -> Int

Filter window height.

Returns:

Int

s​

def s(self) -> Int

Filter window width.

Returns:

Int

filter_window_flat_size​

def filter_window_flat_size(self) -> Int

Returns:

Int

input_image_flat_size​

def input_image_flat_size(self) -> Int

Returns:

Int

output_image_flat_size​

def output_image_flat_size(self) -> Int

Returns:

Int

output_space_dims​

def output_space_dims(self) -> IndexList[rank]

Returns:

IndexList[rank]

output_flat_coord_to_input_offset​

def output_flat_coord_to_input_offset(self, n: Int, output_flat_coord: Int) -> Int

Returns:

Int

matmul_M​

def matmul_M(self) -> Int

Returns:

Int

matmul_N​

def matmul_N(self) -> Int

Returns:

Int

matmul_K​

def matmul_K(self) -> Int

Returns:

Int

padded​

def padded(self) -> Bool

Returns:

Bool

c_per_group​

def c_per_group(self) -> Int

Returns the number of channels per group. Channel count must be divisible by group size.

Returns:

Int

f_per_group​

def f_per_group(self) -> Int

Returns the number of filters per group. Filter count must be divisible by group size.

Returns:

Int

f_to_group​

def f_to_group(self, f_idx: Int) -> Int

Given a global filter idx, returns the group idx of the group the filter belongs to.

Returns:

Int

c_to_group​

def c_to_group(self, c_idx: Int) -> Int

Given a global channel idx, returns the group idx of the group the channel belongs to.

Returns:

Int

f_in_group​

def f_in_group(self, f_idx: Int) -> Int

Given a global filter idx, returns the offset of the filter in its group.

Returns:

Int

c_in_group​

def c_in_group(self, c_idx: Int) -> Int

Given a global channel idx, returns the offset of the channel in its group.

Returns:

Int