pub struct SparseTensorIndexCoo {
pub indices_type: Box<Int>,
pub indices_strides: Option<Vec<i64>>,
pub indices_buffer: Buffer,
pub is_canonical: bool,
}Expand description
EXPERIMENTAL: Data structures for sparse tensors Coordinate (COO) format of sparse tensor index.
COO’s index list are represented as a NxM matrix, where N is the number of non-zero values, and M is the number of dimensions of a sparse tensor.
indicesBuffer stores the location and size of the data of this indices matrix. The value type and the stride of the indices matrix is specified in indicesType and indicesStrides fields.
For example, let X be a 2x3x4x5 tensor, and it has the following 6 non-zero values:
X[0, 1, 2, 0] := 1
X[1, 1, 2, 3] := 2
X[0, 2, 1, 0] := 3
X[0, 1, 3, 0] := 4
X[0, 1, 2, 1] := 5
X[1, 2, 0, 4] := 6In COO format, the index matrix of X is the following 4x6 matrix:
[[0, 0, 0, 0, 1, 1],
[1, 1, 1, 2, 1, 2],
[2, 2, 3, 1, 2, 0],
[0, 1, 0, 0, 3, 4]]When isCanonical is true, the indices is sorted in lexicographical order (row-major order), and it does not have duplicated entries. Otherwise, the indices may not be sorted, or may have duplicated entries.
Generated from these locations:
- Table
SparseTensorIndexCOOin the fileSparseTensor.fbs:58
Fields§
§indices_type: Box<Int>The type of values in indicesBuffer
indices_strides: Option<Vec<i64>>Non-negative byte offsets to advance one value cell along each dimension If omitted, default to row-major order (C-like).
indices_buffer: BufferThe location and size of the indices matrix’s data
is_canonical: boolThis flag is true if and only if the indices matrix is sorted in row-major order, and does not have duplicated entries. This sort order is the same as of Tensorflow’s SparseTensor, but it is inverse order of SciPy’s canonical coo_matrix (SciPy employs column-major order for its coo_matrix).
Implementations§
Source§impl SparseTensorIndexCoo
impl SparseTensorIndexCoo
Sourcepub fn builder() -> SparseTensorIndexCooBuilder<()>
pub fn builder() -> SparseTensorIndexCooBuilder<()>
Creates a SparseTensorIndexCooBuilder for serializing an instance of this table.
pub fn create( builder: &mut Builder, field_indices_type: impl WriteAs<Offset<Int>>, field_indices_strides: impl WriteAsOptional<Offset<[i64]>>, field_indices_buffer: impl WriteAs<Buffer>, field_is_canonical: impl WriteAsDefault<bool, bool>, ) -> Offset<Self>
Trait Implementations§
Source§impl Clone for SparseTensorIndexCoo
impl Clone for SparseTensorIndexCoo
Source§fn clone(&self) -> SparseTensorIndexCoo
fn clone(&self) -> SparseTensorIndexCoo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SparseTensorIndexCoo
impl Debug for SparseTensorIndexCoo
Source§impl Default for SparseTensorIndexCoo
impl Default for SparseTensorIndexCoo
Source§impl<'de> Deserialize<'de> for SparseTensorIndexCoo
impl<'de> Deserialize<'de> for SparseTensorIndexCoo
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 SparseTensorIndexCoo
impl Hash for SparseTensorIndexCoo
Source§impl Ord for SparseTensorIndexCoo
impl Ord for SparseTensorIndexCoo
Source§fn cmp(&self, other: &SparseTensorIndexCoo) -> Ordering
fn cmp(&self, other: &SparseTensorIndexCoo) -> 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 SparseTensorIndexCoo
impl PartialEq for SparseTensorIndexCoo
Source§impl PartialOrd for SparseTensorIndexCoo
impl PartialOrd for SparseTensorIndexCoo
Source§impl Serialize for SparseTensorIndexCoo
impl Serialize for SparseTensorIndexCoo
Source§impl<'a> TryFrom<SparseTensorIndexCooRef<'a>> for SparseTensorIndexCoo
impl<'a> TryFrom<SparseTensorIndexCooRef<'a>> for SparseTensorIndexCoo
impl Eq for SparseTensorIndexCoo
impl StructuralPartialEq for SparseTensorIndexCoo
impl VectorWrite<Offset<SparseTensorIndexCoo>> for SparseTensorIndexCoo
§Safety
The planus compiler generates implementations that initialize
the bytes in write_values.
impl WriteAs<Offset<SparseTensorIndexCoo>> for SparseTensorIndexCoo
impl WriteAsOffset<SparseTensorIndexCoo> for SparseTensorIndexCoo
impl<T0: WriteAs<Offset<Int>>, T1: WriteAsOptional<Offset<[i64]>>, T2: WriteAs<Buffer>, T3: WriteAsDefault<bool, bool>> WriteAsOffset<SparseTensorIndexCoo> for SparseTensorIndexCooBuilder<(T0, T1, T2, T3)>
impl WriteAsOptional<Offset<SparseTensorIndexCoo>> for SparseTensorIndexCoo
Auto Trait Implementations§
impl Freeze for SparseTensorIndexCoo
impl RefUnwindSafe for SparseTensorIndexCoo
impl Send for SparseTensorIndexCoo
impl Sync for SparseTensorIndexCoo
impl Unpin for SparseTensorIndexCoo
impl UnwindSafe for SparseTensorIndexCoo
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