Skip to main content

Mojo function

group_norm_reshape

group_norm_reshape[type: DType, rank: Int](shape: IndexList[rank, element_type=element_type], buf: NDBuffer[type, rank, origin, shape, strides], channels_per_group: Int, spatial: Int) -> NDBuffer[type, 2, origin]

Reshapes an input buffer for group normalization by flattening all dimensions except the group dimension. Returns a 2D buffer of shape (num_groups * N, group_size), where group_size is the product of channels_per_group and spatial.

Was this page helpful?