Trait tc_tensor::SparseAccess
source · [−]pub trait SparseAccess<FD: File<Array>, FS: File<Node>, D: Dir, T: Transaction<D>>: ReadValueAt<D, Txn = T> + TensorAccess + Clone + Display + Send + Sync + 'static {
type Slice: SparseAccess<FD, FS, D, T>;
fn accessor(self) -> SparseAccessor<FD, FS, D, T>;
fn filled<'a, 'async_trait>(
self,
txn: T
) -> Pin<Box<dyn Future<Output = TCResult<Pin<Box<dyn Stream<Item = TCResult<(Coord, Number)>> + Send + Unpin + 'a>>>> + Send + 'async_trait>>
where
'a: 'async_trait,
Self: 'async_trait;
fn filled_at<'a, 'async_trait>(
self,
txn: T,
axes: Vec<usize>
) -> Pin<Box<dyn Future<Output = TCResult<TCBoxTryStream<'a, Coords>>> + Send + 'async_trait>>
where
'a: 'async_trait,
Self: 'async_trait;
fn filled_count<'async_trait>(
self,
txn: T
) -> Pin<Box<dyn Future<Output = TCResult<u64>> + Send + 'async_trait>>
where
Self: 'async_trait;
fn is_empty<'async_trait>(
self,
txn: T
) -> Pin<Box<dyn Future<Output = TCResult<bool>> + Send + 'async_trait>>
where
Self: 'async_trait;
fn slice(self, bounds: Bounds) -> TCResult<Self::Slice>;
fn transpose(
self,
permutation: Option<Vec<usize>>
) -> TCResult<SparseAccessor<FD, FS, D, T>>;
}
Expand description
Access methods for SparseTensor
data
Required Associated Types
type Slice: SparseAccess<FD, FS, D, T>
type Slice: SparseAccess<FD, FS, D, T>
The type of a slice of this accessor
Required Methods
fn accessor(self) -> SparseAccessor<FD, FS, D, T>
fn accessor(self) -> SparseAccessor<FD, FS, D, T>
Return this accessor as a SparseAccessor
.
Return this SparseTensor
’s contents as an ordered stream of (Coord
, [Number
]) pairs.
Return an ordered stream of unique Coord
s on the given axes with nonzero values.
Note: is it not safe to assume that all returned coordinates are filled, but it is safe to assume that all coordinates not returned are not filled.
TODO: add sort
parameter to make sorting results optional.
Return the number of nonzero values in this SparseTensor
.
Return true
if this SparseTensor
contains no elements.
Return a slice of this accessor with the given Bounds
.