Skip to main content

BlockSparseTensorDescriptor

Struct BlockSparseTensorDescriptor 

Source
pub struct BlockSparseTensorDescriptor { /* private fields */ }

Implementations§

Source§

impl BlockSparseTensorDescriptor

Source

pub fn create( ctx: &Context, section_count_per_mode: &[u32], section_extents: &[u64], non_zero_block_count: u64, non_zero_coordinates: &[i32], block_strides: Option<&[u64]>, data_type: DataType, ) -> Result<Self>

Creates a block-sparse tensor descriptor.

A block-sparse tensor descriptor fully specifies the data layout of a block-sparse tensor (currently limited to up to 8 modes).

Consider an example for a block-sparse tensor of order 2, namely a block-sparse matrix A. Its first mode (rows) is subdivided into 5 sections (with extents 4, 2, 3, 4, 5, respectively), and its second mode (columns) is subdivided into 3 sections (with extents 2, 3, 7). The matrix has 8 non-zero blocks:

2 columns3 columns7 columns
4 x 24 x 7
2 x 3
3 x 33 x 7
4 x 2
5 x 35 x 7

Each subsection has the same extent across its entire mode: every block within the same section of a mode has the same extent. For example, in the table above every block on the right has 7 columns, and all blocks on the bottom have 5 rows.

Only non-zero blocks are stored; zero blocks are left blank in the representation above.

For example:

  • strides of block #0: 5, 1, 10, 20. Sorted strides would be: 1, 5, 10, 20. The permutation to sort the strides in this case is to swap the first two elements.
  • strides of block #1: 10, 1, 30, 60. Applying the permutation would result in: 1, 10, 30, 60. The result is sorted in ascending order, which is allowed.
  • strides of block #2: 1, 5, 50, 100. Applying permutation would result in: 5, 1, 50, 100. The result is not sorted in ascending order, this is not allowed.

This non-blocking call is thread-safe but not reentrant.

§Errors

Returns an error if the context cannot be bound, the section extent, coordinate, or stride slices do not match the descriptor dimensions, a value cannot be represented for cuTENSOR, cuTENSOR rejects the descriptor, or cuTENSOR returns a null descriptor handle.

Source

pub fn mode_count(&self) -> u32

Source

pub fn non_zero_block_count(&self) -> u64

Source

pub fn data_type(&self) -> DataType

Source

pub const fn as_raw(&self) -> cutensorBlockSparseTensorDescriptor_t

Trait Implementations§

Source§

impl Debug for BlockSparseTensorDescriptor

Source§

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

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

impl Drop for BlockSparseTensorDescriptor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> 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, 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.