Struct SparseTensorIndexCSF
pub struct SparseTensorIndexCSF<'a> {
pub _tab: Table<'a>,
}
Expand description
Compressed Sparse Fiber (CSF) sparse tensor index.
Fields§
§_tab: Table<'a>
Implementations§
§impl<'a> SparseTensorIndexCSF<'a>
impl<'a> SparseTensorIndexCSF<'a>
pub const VT_INDPTRTYPE: u16 = 4u16
pub const VT_INDPTRBUFFERS: u16 = 6u16
pub const VT_INDICESTYPE: u16 = 8u16
pub const VT_INDICESBUFFERS: u16 = 10u16
pub const VT_AXISORDER: u16 = 12u16
pub unsafe fn init_from_table(table: Table<'a>) -> SparseTensorIndexCSF<'a>
pub fn create<'bldr, 'args, 'mut_bldr, A>(
_fbb: &'mut_bldr mut FlatBufferBuilder<'bldr, A>,
args: &'args SparseTensorIndexCSFArgs<'args>,
) -> WIPOffset<SparseTensorIndexCSF<'bldr>>where
'bldr: 'args,
'args: 'mut_bldr,
A: Allocator + 'bldr,
pub fn indptrType(&self) -> Int<'a>
pub fn indptrType(&self) -> Int<'a>
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] := 8
As a prefix tree this would be represented as:
0 1
/ \ |
0 1 1
/ / \ |
0 0 1 1
/| /| | /| |
1 2 0 2 0 0 1 2
The type of values in indptrBuffers
pub fn indptrBuffers(&self) -> Vector<'a, Buffer>
pub fn indptrBuffers(&self) -> Vector<'a, 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]
].
pub fn indicesType(&self) -> Int<'a>
pub fn indicesType(&self) -> Int<'a>
The type of values in indicesBuffers
pub fn indicesBuffers(&self) -> Vector<'a, Buffer>
pub fn indicesBuffers(&self) -> Vector<'a, 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]
].
Trait Implementations§
§impl<'a> Clone for SparseTensorIndexCSF<'a>
impl<'a> Clone for SparseTensorIndexCSF<'a>
§fn clone(&self) -> SparseTensorIndexCSF<'a>
fn clone(&self) -> SparseTensorIndexCSF<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for SparseTensorIndexCSF<'_>
impl Debug for SparseTensorIndexCSF<'_>
§impl<'a> Follow<'a> for SparseTensorIndexCSF<'a>
impl<'a> Follow<'a> for SparseTensorIndexCSF<'a>
type Inner = SparseTensorIndexCSF<'a>
§impl<'a> PartialEq for SparseTensorIndexCSF<'a>
impl<'a> PartialEq for SparseTensorIndexCSF<'a>
§impl Verifiable for SparseTensorIndexCSF<'_>
impl Verifiable for SparseTensorIndexCSF<'_>
§fn run_verifier(
v: &mut Verifier<'_, '_>,
pos: usize,
) -> Result<(), InvalidFlatbuffer>
fn run_verifier( v: &mut Verifier<'_, '_>, pos: usize, ) -> Result<(), InvalidFlatbuffer>
pos
in the verifier’s buffer.
Should not need to be called directly.impl<'a> Copy for SparseTensorIndexCSF<'a>
impl<'a> StructuralPartialEq for SparseTensorIndexCSF<'a>
Auto Trait Implementations§
impl<'a> Freeze for SparseTensorIndexCSF<'a>
impl<'a> RefUnwindSafe for SparseTensorIndexCSF<'a>
impl<'a> Send for SparseTensorIndexCSF<'a>
impl<'a> Sync for SparseTensorIndexCSF<'a>
impl<'a> Unpin for SparseTensorIndexCSF<'a>
impl<'a> UnwindSafe for SparseTensorIndexCSF<'a>
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request