Skip to main content
Log in

Mojo struct

ConvShape

@register_passable(trivial) struct ConvShape[rank: Int]

A shape struct describing the convolution dimensions.

Fields

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

Implemented traits

AnyType, Copyable, ExplicitlyCopyable, Movable, UnknownDestructibility

Methods

d

d(self) -> Int

Input depth.

h

h(self) -> Int

Input height.

w

w(self) -> Int

Input width.

do

do(self) -> Int

Output depth.

ho

ho(self) -> Int

Output height.

wo

wo(self) -> Int

Output width.

q

q(self) -> Int

Filter window depth.

r

r(self) -> Int

Filter window height.

s

s(self) -> Int

Filter windown width.

filter_window_flat_size

filter_window_flat_size(self) -> Int

input_image_flat_size

input_image_flat_size(self) -> Int

output_image_flat_size

output_image_flat_size(self) -> Int

output_space_dims

output_space_dims(self) -> Index[rank]

output_flat_coord_to_input_offset

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

matmul_M

matmul_M(self) -> Int

matmul_N

matmul_N(self) -> Int

matmul_K

matmul_K(self) -> Int

padded

padded(self) -> Bool

c_per_group

c_per_group(self) -> Int

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

f_per_group

f_per_group(self) -> Int

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

f_to_group

f_to_group(self, f_idx: Int) -> Int

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

c_to_group

c_to_group(self, c_idx: Int) -> Int

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

f_in_group

f_in_group(self, f_idx: Int) -> Int

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

c_in_group

c_in_group(self, c_idx: Int) -> Int

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

Was this page helpful?