Skip to main content

SparseTensorOps

Trait SparseTensorOps 

Source
pub trait SparseTensorOps:
    Clone
    + Send
    + Sync
    + TensorBase {
    // Required methods
    fn nnz(&self) -> usize;
    fn coo(&self) -> COOView<'_>;
    fn row_indices(&self) -> &[usize];
    fn col_indices(&self) -> &[usize];
    fn values(&self) -> &DenseTensor;

    // Provided method
    fn sparsity(&self) -> f64 { ... }
}
Expand description

稀疏张量操作 trait

Required Methods§

Source

fn nnz(&self) -> usize

获取非零元素数量

Source

fn coo(&self) -> COOView<'_>

获取 COO 格式视图

Source

fn row_indices(&self) -> &[usize]

获取行索引

Source

fn col_indices(&self) -> &[usize]

获取列索引

Source

fn values(&self) -> &DenseTensor

获取非零值(作为 DenseTensor)

Provided Methods§

Source

fn sparsity(&self) -> f64

获取稀疏度(非零元素比例)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl SparseTensorOps for SparseTensor

Available on crate feature tensor only.