pub struct Im2colReader<E: Numeric> {
pub tensor: VirtualTensor<E>,
pub m_offset: u32,
pub k_offset: u32,
pub stride_batch: u32,
pub strides_spatial: Sequence<u32>,
pub stride_channel: u32,
pub shapes_spatial: Sequence<u32>,
pub shape_channel: u32,
pub shape_out: Sequence<FastDivmod>,
pub shape_m: u32,
pub shape_k: u32,
}
Expand description
A view of a feature map tensor that starts reading data from a specified offset. Ensures safe access by preventing out-of-bounds errors. Includes pre-fetched shapes and strides for optimized performance.
Fields§
§tensor: VirtualTensor<E>
§m_offset: u32
§k_offset: u32
§stride_batch: u32
§strides_spatial: Sequence<u32>
§stride_channel: u32
§shapes_spatial: Sequence<u32>
§shape_channel: u32
§shape_out: Sequence<FastDivmod>
§shape_m: u32
§shape_k: u32
Implementations§
Source§impl<E: Numeric> Im2colReader<E>
impl<E: Numeric> Im2colReader<E>
pub fn new( tensor: VirtualTensor<E>, shape_out: Sequence<FastDivmod>, x_offset: u32, y_offset: u32, shape_k: u32, shape_m: u32, ) -> Im2colReader<E>
pub fn __expand_new( scope: &mut Scope, tensor: <VirtualTensor<E> as CubeType>::ExpandType, shape_out: <Sequence<FastDivmod> as CubeType>::ExpandType, x_offset: <u32 as CubeType>::ExpandType, y_offset: <u32 as CubeType>::ExpandType, shape_k: <u32 as CubeType>::ExpandType, shape_m: <u32 as CubeType>::ExpandType, ) -> <Im2colReader<E> as CubeType>::ExpandType
Source§impl<E: Numeric> Im2colReader<E>
impl<E: Numeric> Im2colReader<E>
Sourcepub fn update_view(&mut self, k_offset: u32)
pub fn update_view(&mut self, k_offset: u32)
Advance the view along the k dimension by a specified offset, k_offset
.
Sourcepub fn load_simple<G: ConvGemmConfig>(
&self,
tile_x: u32,
tile_y: u32,
unit_id: u32,
ident: Ident,
config: G,
) -> Line<E>
pub fn load_simple<G: ConvGemmConfig>( &self, tile_x: u32, tile_y: u32, unit_id: u32, ident: Ident, config: G, ) -> Line<E>
Reads data from the tensor view at the specified tile coordinates (tile_x, tile_y) using
the im2col
algorithm to translate them to input coordinates.
Each unit loads one line in a coalesced manner for improved efficiency. For row-major tensors, subsequent units read lines horizontally within the tile, while for column-major tensors, they read lines vertically.
§Note
Out-of-bounds reads will be translated to zeros.
pub fn __expand_update_view( scope: &mut Scope, this: <Self as CubeType>::ExpandType, k_offset: <u32 as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType
pub fn __expand_load_simple<G: ConvGemmConfig>( scope: &mut Scope, this: <Self as CubeType>::ExpandType, tile_x: <u32 as CubeType>::ExpandType, tile_y: <u32 as CubeType>::ExpandType, unit_id: <u32 as CubeType>::ExpandType, ident: Ident, config: G, ) -> <Line<E> as CubeType>::ExpandType
Trait Implementations§
Source§impl<E: Numeric> CubeType for Im2colReader<E>
impl<E: Numeric> CubeType for Im2colReader<E>
type ExpandType = Im2colReaderExpand<E>
Source§fn into_mut(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType
fn into_mut(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType
Wrapper around the init method, necessary to type inference.
impl<E: Numeric> Send for Im2colReader<E>
impl<E: Numeric> Sync for Im2colReader<E>
Auto Trait Implementations§
impl<E> Freeze for Im2colReader<E>
impl<E> RefUnwindSafe for Im2colReader<E>where
E: RefUnwindSafe,
impl<E> Unpin for Im2colReader<E>where
E: Unpin,
impl<E> UnwindSafe for Im2colReader<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more