pub enum SparseTensor {
CSR(SparseCSR),
CSC(SparseCSC),
COO(SparseCOO),
}Expand description
Sparse tensor representation.
Variants§
CSR(SparseCSR)
2D matrix in CSR format
CSC(SparseCSC)
2D matrix in CSC format
COO(SparseCOO)
2D matrix in COO format
Implementations§
Source§impl SparseTensor
impl SparseTensor
Sourcepub fn builder(shape: Vec<usize>, format: SparseFormat) -> SparseTensorBuilder
pub fn builder(shape: Vec<usize>, format: SparseFormat) -> SparseTensorBuilder
Create a sparse tensor builder.
Sourcepub fn format(&self) -> SparseFormat
pub fn format(&self) -> SparseFormat
Get the sparse format.
Sourcepub fn sparsity_ratio(&self) -> f64
pub fn sparsity_ratio(&self) -> f64
Get sparsity ratio.
Sourcepub fn to_csr(&self) -> Result<SparseTensor, SparseError>
pub fn to_csr(&self) -> Result<SparseTensor, SparseError>
Convert to CSR format.
Sourcepub fn to_csc(&self) -> Result<SparseTensor, SparseError>
pub fn to_csc(&self) -> Result<SparseTensor, SparseError>
Convert to CSC format.
Sourcepub fn to_coo(&self) -> Result<SparseTensor, SparseError>
pub fn to_coo(&self) -> Result<SparseTensor, SparseError>
Convert to COO format.
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Get memory usage in bytes.
Trait Implementations§
Source§impl Clone for SparseTensor
impl Clone for SparseTensor
Source§fn clone(&self) -> SparseTensor
fn clone(&self) -> SparseTensor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SparseTensor
impl Debug for SparseTensor
Source§impl<'de> Deserialize<'de> for SparseTensor
impl<'de> Deserialize<'de> for SparseTensor
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SparseTensor
impl PartialEq for SparseTensor
Source§impl Serialize for SparseTensor
impl Serialize for SparseTensor
impl StructuralPartialEq for SparseTensor
Auto Trait Implementations§
impl Freeze for SparseTensor
impl RefUnwindSafe for SparseTensor
impl Send for SparseTensor
impl Sync for SparseTensor
impl Unpin for SparseTensor
impl UnwindSafe for SparseTensor
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