Mojo function
pack_filter
pack_filter(filter: LayoutTensor[dtype, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], packed_filter: LayoutTensor[dtype, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], num_groups: Int)
This packs the filter form RSCF to FRSCf. Use the default micro kernel size for dynamic shapes.
pack_filter[simd_size: Int, micro_kernel_f_size: Int](filter: LayoutTensor[dtype, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], packed_filter: LayoutTensor[dtype, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], num_groups: Int)
This packs the filter form RSCF to FRSCf.
F is first broken down to segments of size micro_kernel_f_size, then the remainder is further divided by simd_size. The last residual elements if any is padded with zero to fill simd_size.
Parameters:
- simd_size (
Int): Can differ from the simd size of the input type. - micro_kernel_f_size (
Int): The size of the last dimension in FRSCf, which is equals the size of the micro kernel's F dimension. 
Args:
- filter (
LayoutTensor): Filter in RSCF layout (if 2D). - packed_filter (
LayoutTensor): Packed filter in FRSCf layout (if 2D). F - the index of continuous segments in micro kernel. R, S, C - original R, S, C. f - the index within a continuous segments. - num_groups (
Int): The number of groups in the convolution. 
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!