pub struct SparseTensorIndexCsf {
pub indptr_type: Box<Int>,
pub indptr_buffers: Vec<Buffer>,
pub indices_type: Box<Int>,
pub indices_buffers: Vec<Buffer>,
pub axis_order: Vec<i32>,
}Expand description
Compressed Sparse Fiber (CSF) sparse tensor index.
Generated from these locations:
- Table
SparseTensorIndexCSFin the fileSparseTensor.fbs:128
Fields§
§indptr_type: Box<Int>CSF is a generalization of compressed sparse row (CSR) index. See smith2017knl
CSF index recursively compresses each dimension of a tensor into a set of prefix trees. Each path from a root to leaf forms one tensor non-zero index. CSF is implemented with two arrays of buffers and one arrays of integers.
For example, let X be a 2x3x4x5 tensor and let it have the following 8 non-zero values:
X[0, 0, 0, 1] := 1
X[0, 0, 0, 2] := 2
X[0, 1, 0, 0] := 3
X[0, 1, 0, 2] := 4
X[0, 1, 1, 0] := 5
X[1, 1, 1, 0] := 6
X[1, 1, 1, 1] := 7
X[1, 1, 1, 2] := 8As a prefix tree this would be represented as:
0 1
/ \ |
0 1 1
/ / \ |
0 0 1 1
/| /| | /| |
1 2 0 2 0 0 1 2The type of values in indptrBuffers
indptr_buffers: Vec<Buffer>indptrBuffers stores the sparsity structure.
Each two consecutive dimensions in a tensor correspond to a buffer in
indptrBuffers. A pair of consecutive values at indptrBuffers[dim][i]
and indptrBuffers[dim][i + 1] signify a range of nodes in
indicesBuffers[dim + 1] who are children of indicesBuffers[dim][i] node.
For example, the indptrBuffers for the above X is:
indptrBuffer(X) = [
[0, 2, 3],
[0, 1, 3, 4],
[0, 2, 4, 5, 8]
].indices_type: Box<Int>The type of values in indicesBuffers
indices_buffers: Vec<Buffer>indicesBuffers stores values of nodes. Each tensor dimension corresponds to a buffer in indicesBuffers. For example, the indicesBuffers for the above X is:
indicesBuffer(X) = [
[0, 1],
[0, 1, 1],
[0, 0, 1, 1],
[1, 2, 0, 2, 0, 0, 1, 2]
].axis_order: Vec<i32>axisOrder stores the sequence in which dimensions were traversed to produce the prefix tree. For example, the axisOrder for the above X is:
axisOrder(X) = [0, 1, 2, 3].Implementations§
Source§impl SparseTensorIndexCsf
impl SparseTensorIndexCsf
Sourcepub fn builder() -> SparseTensorIndexCsfBuilder<()>
pub fn builder() -> SparseTensorIndexCsfBuilder<()>
Creates a SparseTensorIndexCsfBuilder for serializing an instance of this table.
pub fn create( builder: &mut Builder, field_indptr_type: impl WriteAs<Offset<Int>>, field_indptr_buffers: impl WriteAs<Offset<[Buffer]>>, field_indices_type: impl WriteAs<Offset<Int>>, field_indices_buffers: impl WriteAs<Offset<[Buffer]>>, field_axis_order: impl WriteAs<Offset<[i32]>>, ) -> Offset<Self>
Trait Implementations§
Source§impl Clone for SparseTensorIndexCsf
impl Clone for SparseTensorIndexCsf
Source§fn clone(&self) -> SparseTensorIndexCsf
fn clone(&self) -> SparseTensorIndexCsf
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SparseTensorIndexCsf
impl Debug for SparseTensorIndexCsf
Source§impl Default for SparseTensorIndexCsf
impl Default for SparseTensorIndexCsf
Source§impl<'de> Deserialize<'de> for SparseTensorIndexCsf
impl<'de> Deserialize<'de> for SparseTensorIndexCsf
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>,
Source§impl Hash for SparseTensorIndexCsf
impl Hash for SparseTensorIndexCsf
Source§impl Ord for SparseTensorIndexCsf
impl Ord for SparseTensorIndexCsf
Source§fn cmp(&self, other: &SparseTensorIndexCsf) -> Ordering
fn cmp(&self, other: &SparseTensorIndexCsf) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SparseTensorIndexCsf
impl PartialEq for SparseTensorIndexCsf
Source§impl PartialOrd for SparseTensorIndexCsf
impl PartialOrd for SparseTensorIndexCsf
Source§impl Serialize for SparseTensorIndexCsf
impl Serialize for SparseTensorIndexCsf
Source§impl<'a> TryFrom<SparseTensorIndexCsfRef<'a>> for SparseTensorIndexCsf
impl<'a> TryFrom<SparseTensorIndexCsfRef<'a>> for SparseTensorIndexCsf
impl Eq for SparseTensorIndexCsf
impl StructuralPartialEq for SparseTensorIndexCsf
impl VectorWrite<Offset<SparseTensorIndexCsf>> for SparseTensorIndexCsf
§Safety
The planus compiler generates implementations that initialize
the bytes in write_values.
impl WriteAs<Offset<SparseTensorIndexCsf>> for SparseTensorIndexCsf
impl WriteAsOffset<SparseTensorIndexCsf> for SparseTensorIndexCsf
impl<T0: WriteAs<Offset<Int>>, T1: WriteAs<Offset<[Buffer]>>, T2: WriteAs<Offset<Int>>, T3: WriteAs<Offset<[Buffer]>>, T4: WriteAs<Offset<[i32]>>> WriteAsOffset<SparseTensorIndexCsf> for SparseTensorIndexCsfBuilder<(T0, T1, T2, T3, T4)>
impl WriteAsOptional<Offset<SparseTensorIndexCsf>> for SparseTensorIndexCsf
Auto Trait Implementations§
impl Freeze for SparseTensorIndexCsf
impl RefUnwindSafe for SparseTensorIndexCsf
impl Send for SparseTensorIndexCsf
impl Sync for SparseTensorIndexCsf
impl Unpin for SparseTensorIndexCsf
impl UnwindSafe for SparseTensorIndexCsf
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more