Trait tc_tensor::SparseAccess
source · pub trait SparseAccess<FD, FS, D, T>: ReadValueAt<D, Txn = T> + TensorAccess + Clone + Display + Send + Sync + 'staticwhere
D: Dir,
T: Transaction<D>,{
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
Self: 'async_trait,
'a: '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
Self: 'async_trait,
'a: '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§
sourcetype Slice: SparseAccess<FD, FS, D, T>
type Slice: SparseAccess<FD, FS, D, T>
The type of a slice of this accessor
Required Methods§
sourcefn accessor(self) -> SparseAccessor<FD, FS, D, T>
fn accessor(self) -> SparseAccessor<FD, FS, D, T>
Return this accessor as a SparseAccessor
.
sourcefn 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
Self: 'async_trait,
'a: 'async_trait,
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
Self: 'async_trait,
'a: 'async_trait,
Return this SparseTensor
’s contents as an ordered stream of (Coord
, [Number
]) pairs.
sourcefn filled_at<'a, 'async_trait>(
self,
txn: T,
axes: Vec<usize>
) -> Pin<Box<dyn Future<Output = TCResult<TCBoxTryStream<'a, Coords>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: '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
Self: 'async_trait,
'a: 'async_trait,
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.
sourcefn filled_count<'async_trait>(
self,
txn: T
) -> Pin<Box<dyn Future<Output = TCResult<u64>> + Send + 'async_trait>>where
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,
Return the number of nonzero values in this SparseTensor
.
sourcefn is_empty<'async_trait>(
self,
txn: T
) -> Pin<Box<dyn Future<Output = TCResult<bool>> + 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,
Return true
if this SparseTensor
contains no elements.