Enum tc_tensor::Tensor [−][src]
pub enum Tensor<FD, FS, D, T> { Dense(DenseTensor<FD, FS, D, T, DenseAccessor<FD, FS, D, T>>), Sparse(SparseTensor<FD, FS, D, T, SparseAccessor<FD, FS, D, T>>), }
Expand description
An n-dimensional array of numbers which supports basic math and logic operations
Variants
Tuple Fields of Dense
0: DenseTensor<FD, FS, D, T, DenseAccessor<FD, FS, D, T>>
Tuple Fields of Sparse
0: SparseTensor<FD, FS, D, T, SparseAccessor<FD, FS, D, T>>
Trait Implementations
impl<FD, FS, D, T, B> From<DenseTensor<FD, FS, D, T, B>> for Tensor<FD, FS, D, T> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, B> From<DenseTensor<FD, FS, D, T, B>> for Tensor<FD, FS, D, T> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
Performs the conversion.
impl<FD, FS, D, T, A> From<SparseTensor<FD, FS, D, T, A>> for Tensor<FD, FS, D, T> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> From<SparseTensor<FD, FS, D, T, A>> for Tensor<FD, FS, D, T> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
Performs the conversion.
type Context = T
type Context = T
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
fn from_stream<'life0, 'async_trait, De: Decoder>(
txn: T,
decoder: &'life0 mut De
) -> Pin<Box<dyn Future<Output = Result<Self, De::Error>> + Send + 'async_trait>> where
De: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn from_stream<'life0, 'async_trait, De: Decoder>(
txn: T,
decoder: &'life0 mut De
) -> Pin<Box<dyn Future<Output = Result<Self, De::Error>> + Send + 'async_trait>> where
De: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Parse this value using the given Decoder
.
impl<FD, FS, D, T, B> TensorBoolean<Tensor<FD, FS, D, T>> for DenseTensor<FD, FS, D, T, B> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, B> TensorBoolean<Tensor<FD, FS, D, T>> for DenseTensor<FD, FS, D, T, B> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorBoolean<Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorBoolean<Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, B> TensorCompare<Tensor<FD, FS, D, T>> for DenseTensor<FD, FS, D, T, B> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, B> TensorCompare<Tensor<FD, FS, D, T>> for DenseTensor<FD, FS, D, T, B> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
The result of a comparison operation which can only return a dense Tensor
Element-wise greater-or-equal
impl<FD, FS, D, T, A> TensorCompare<Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorCompare<Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
The result of a comparison operation which can only return a dense Tensor
Element-wise greater-or-equal
type Compare = Self
type Compare = Self
The result of a comparison operation
impl<FD, FS, D, T, B> TensorDualIO<D, Tensor<FD, FS, D, T>> for DenseTensor<FD, FS, D, T, B> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseWrite<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, B> TensorDualIO<D, Tensor<FD, FS, D, T>> for DenseTensor<FD, FS, D, T, B> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseWrite<FD, FS, D, T>,
D::FileClass: From<TensorType>,
type Txn = T
type Txn = T
The type of Transaction
to expect
Zero out the elements of this Tensor
where the corresponding element of value
is nonzero.
impl<FD, FS, D, T, A> TensorDualIO<D, Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseWrite<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorDualIO<D, Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseWrite<FD, FS, D, T>,
D::FileClass: From<TensorType>,
type Txn = T
type Txn = T
The type of Transaction
to expect
Zero out the elements of this Tensor
where the corresponding element of value
is nonzero.
type Txn = T
type Txn = T
The type of Transaction
to expect
Zero out the elements of this Tensor
where the corresponding element of value
is nonzero.
impl<FD, FS, D, T, B> TensorMath<D, Tensor<FD, FS, D, T>> for DenseTensor<FD, FS, D, T, B> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, B> TensorMath<D, Tensor<FD, FS, D, T>> for DenseTensor<FD, FS, D, T, B> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
Multiply two tensors together.
impl<FD, FS, D, T, A> TensorMath<D, Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorMath<D, Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
Multiply two tensors together.
type Combine = Self
type Combine = Self
The result type of a math operation
type Txn = T
type Txn = T
The type of Transaction
to expect
type Reduce = Self
type Reduce = Self
The result type of a reduce operation
Return the product of this Tensor
along the given axis
.
Return the product of all elements in this Tensor
.
Return the sum of this Tensor
along the given axis
.
Return the sum of all elements in this Tensor
.
Insert a new dimension of size 1 at the given axis
.
Return a slice of this Tensor
with the given bounds
.
type Txn = T
type Txn = T
The type of Transaction
to expect
type Unary = Self
type Unary = Self
The return type of a unary operation
Return true
if all elements in this Tensor
are nonzero.
Return true
if any element in this Tensor
is nonzero.
Auto Trait Implementations
impl<FD, FS, D, T> RefUnwindSafe for Tensor<FD, FS, D, T> where
D: RefUnwindSafe,
FD: RefUnwindSafe,
FS: RefUnwindSafe,
T: RefUnwindSafe,
impl<FD, FS, D, T> Send for Tensor<FD, FS, D, T> where
D: Send + Sync,
FD: Send,
FS: Send + Sync,
T: Send + Sync,
impl<FD, FS, D, T> Sync for Tensor<FD, FS, D, T> where
D: Send + Sync,
FD: Sync,
FS: Send + Sync,
T: Send + Sync,
impl<FD, FS, D, T> UnwindSafe for Tensor<FD, FS, D, T> where
D: RefUnwindSafe + UnwindSafe,
FD: UnwindSafe,
FS: RefUnwindSafe + UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns true
if self
can be cast into the target type T
.
type Output = T
type Output = T
Should always be Self
Test if value
can be cast into Self
.
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
Test if self
can be cast into T
.
Returns Some(T)
if self
can be cast into T
, otherwise None
.
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
Returns Ok(T)
if self
can be cast into T
, otherwise calls on_err
.