Enum TensorMapFormat

Source
pub enum TensorMapFormat {
    Tiled {
        tile_size: Vec<u32>,
    },
    Im2col {
        pixel_box_lower_corner: Vec<i32>,
        pixel_box_upper_corner: Vec<i32>,
        channels_per_pixel: u32,
        pixels_per_column: u32,
    },
    Im2colWide {
        pixel_box_lower_corner_width: i32,
        pixel_box_upper_corner_width: i32,
        channels_per_pixel: u32,
        pixels_per_column: u32,
    },
}
Expand description

Format of [TensorMap]

Variants§

§

Tiled

Simple tiling

Fields

§tile_size: Vec<u32>

Tile size that’s loaded from memory in each copy operation. Must have rank elements. In matmul, for example, this might be batch x m x k, or whatever the stage size is. If a dimension isn’t present in the tile, it should just be set to 1.

For CUDA, this must be a power of two and <= 256 on each dimension.

§

Im2col

Im2col indexing. Loads a “column” (not the same column as im2col) of pixels into shared memory, with a certain offset (kernel position). The corners are the bounds to load pixels from at offset 0, so the top left corner of the kernel. The offset is added to the corner offsets, so a (-1, -1) corner will stop the bounding box at (1, 1) for kernel offset (2, 2).

Fields

§pixel_box_lower_corner: Vec<i32>

Pixel box lower corner. This is the logical upper left corner in the input tensor, when offset is 0. The length of this value should equal the spatial dimensions of the input tensor (i.e. h, w for an NHWC tensor). Should normally be set to -padding.

§pixel_box_upper_corner: Vec<i32>

Pixel box top corner. This is the logical lower right corner in the input tensor, when offset is 0. The length of this value should equal the spatial dimensions of the input tensor (i.e. h, w for an NHWC tensor). Should normally be set to padding - kernel_size - 1 (where kernel_size accounts for dilation). This is not equal to padding, it’s equal to the bounding box for the top left corner of the kernel.

§channels_per_pixel: u32

Channels to load per pixel, should be a multiple or divisor of the matmul tile size. This is not the total number of channels in the tensor, but only the number loaded in each load. Must be <= 256 and aligned to 16 bytes.

§pixels_per_column: u32

Pixels per column, equivalent to the m/n dimension of each tile in the matrix multiplication. i.e. NHW for a 4D tensor. Must be <= 256 and aligned to 16 bytes

§

Im2colWide

Wide im2col

Fields

§pixel_box_lower_corner_width: i32

Pixel box lower corner width. TODO: How does this work?

§pixel_box_upper_corner_width: i32

Pixel box upper corner width. TODO: How does this work?

§channels_per_pixel: u32

Channels per pixel

§pixels_per_column: u32

Pixels per column

Trait Implementations§

Source§

impl Clone for TensorMapFormat

Source§

fn clone(&self) -> TensorMapFormat

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TensorMapFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TensorMapFormat

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TensorMapFormat, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for TensorMapFormat

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TensorMapFormat

Source§

fn eq(&self, other: &TensorMapFormat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TensorMapFormat

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for TensorMapFormat

Source§

impl StructuralPartialEq for TensorMapFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> CacheKey for T

Source§

impl<T> CacheValue for T

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,