Skip to main content

SparseOps

Trait SparseOps 

Source
pub trait SparseOps: Backend {
    type CsrHandle: Clone + Debug + Send + 'static;
    type CsrData: Clone + Debug + Send + 'static;
    type SparseError: Debug + Display;

Show 19 methods // Required methods fn csr_from_data( data: &Self::CsrData, device: &Self::Device, ) -> Result<Self::CsrHandle, Self::SparseError>; fn csr_to_device( matrix: &Self::CsrHandle, device: &Self::Device, ) -> Self::CsrHandle; fn csr_transpose_with_permutation( matrix: &Self::CsrHandle, ) -> Result<(Self::CsrHandle, Vec<u32>), Self::SparseError>; async fn csr_to_data( matrix: &Self::CsrHandle, values: Self::FloatTensorPrimitive, ) -> Result<Self::CsrData, Self::SparseError>; fn csr_shape(matrix: &Self::CsrHandle) -> [usize; 2]; fn csr_nnz(matrix: &Self::CsrHandle) -> usize; fn csr_add_prepare( left: &Self::CsrHandle, right: &Self::CsrHandle, ) -> Result<CsrAddition<Self::CsrHandle>, Self::SparseError>; fn csr_add( plan: &CsrAddition<Self::CsrHandle>, left: Self::FloatTensorPrimitive, right: Self::FloatTensorPrimitive, alpha: f32, beta: f32, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>; fn csr_product_pattern( left: &Self::CsrHandle, right: &Self::CsrHandle, ) -> Result<Self::CsrHandle, Self::SparseError>; fn csr_sampled_sparse_matmul( pattern: &Self::CsrHandle, left: &Self::CsrHandle, left_values: Self::FloatTensorPrimitive, right: &Self::CsrHandle, right_values: Self::FloatTensorPrimitive, transpose_left: bool, transpose_right: bool, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>; fn csr_validate_operand<T>( matrix: &Self::CsrHandle, operand: &T, device: &Self::Device, shape: &[usize], ) -> Result<(), Self::SparseError> where T: TensorMetadata; fn csr_values(matrix: &Self::CsrHandle) -> Self::FloatTensorPrimitive; fn csr_validate_values( matrix: &Self::CsrHandle, values: &Self::FloatTensorPrimitive, ) -> Result<(), Self::SparseError>; fn csr_gather( matrix: &Self::CsrHandle, dense: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>; fn csr_scatter_add( matrix: &Self::CsrHandle, values: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>; fn csr_to_dense( matrix: &Self::CsrHandle, values: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>; fn csr_to_dense_backward( matrix: &Self::CsrHandle, grad: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>; fn csr_matmul( matrix: &Self::CsrHandle, values: Self::FloatTensorPrimitive, rhs: Self::FloatTensorPrimitive, transpose: bool, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>; fn csr_sampled_matmul( matrix: &Self::CsrHandle, lhs: Self::FloatTensorPrimitive, rhs: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>;
}

Required Associated Types§

Required Methods§

Source

fn csr_from_data( data: &Self::CsrData, device: &Self::Device, ) -> Result<Self::CsrHandle, Self::SparseError>

Source

fn csr_to_device( matrix: &Self::CsrHandle, device: &Self::Device, ) -> Self::CsrHandle

Source

fn csr_transpose_with_permutation( matrix: &Self::CsrHandle, ) -> Result<(Self::CsrHandle, Vec<u32>), Self::SparseError>

Source

async fn csr_to_data( matrix: &Self::CsrHandle, values: Self::FloatTensorPrimitive, ) -> Result<Self::CsrData, Self::SparseError>

Source

fn csr_shape(matrix: &Self::CsrHandle) -> [usize; 2]

Source

fn csr_nnz(matrix: &Self::CsrHandle) -> usize

Source

fn csr_add_prepare( left: &Self::CsrHandle, right: &Self::CsrHandle, ) -> Result<CsrAddition<Self::CsrHandle>, Self::SparseError>

Source

fn csr_add( plan: &CsrAddition<Self::CsrHandle>, left: Self::FloatTensorPrimitive, right: Self::FloatTensorPrimitive, alpha: f32, beta: f32, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>

Source

fn csr_product_pattern( left: &Self::CsrHandle, right: &Self::CsrHandle, ) -> Result<Self::CsrHandle, Self::SparseError>

Source

fn csr_sampled_sparse_matmul( pattern: &Self::CsrHandle, left: &Self::CsrHandle, left_values: Self::FloatTensorPrimitive, right: &Self::CsrHandle, right_values: Self::FloatTensorPrimitive, transpose_left: bool, transpose_right: bool, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>

Source

fn csr_validate_operand<T>( matrix: &Self::CsrHandle, operand: &T, device: &Self::Device, shape: &[usize], ) -> Result<(), Self::SparseError>
where T: TensorMetadata,

Source

fn csr_values(matrix: &Self::CsrHandle) -> Self::FloatTensorPrimitive

Source

fn csr_validate_values( matrix: &Self::CsrHandle, values: &Self::FloatTensorPrimitive, ) -> Result<(), Self::SparseError>

Source

fn csr_gather( matrix: &Self::CsrHandle, dense: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>

Source

fn csr_scatter_add( matrix: &Self::CsrHandle, values: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>

Source

fn csr_to_dense( matrix: &Self::CsrHandle, values: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>

Source

fn csr_to_dense_backward( matrix: &Self::CsrHandle, grad: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>

Source

fn csr_matmul( matrix: &Self::CsrHandle, values: Self::FloatTensorPrimitive, rhs: Self::FloatTensorPrimitive, transpose: bool, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>

Source

fn csr_sampled_matmul( matrix: &Self::CsrHandle, lhs: Self::FloatTensorPrimitive, rhs: Self::FloatTensorPrimitive, ) -> Result<Self::FloatTensorPrimitive, Self::SparseError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§