Enum tc_collection::tensor::Tensor
source · pub enum Tensor<Txn, FE> {
Dense(Dense<Txn, FE>),
Sparse(Sparse<Txn, FE>),
}
Expand description
An n-dimensional array of numbers which supports transactional reads and writes
Variants§
Trait Implementations§
source§impl<Txn, FE> AsType<Tensor<Txn, FE>> for Collection<Txn, FE>
impl<Txn, FE> AsType<Tensor<Txn, FE>> for Collection<Txn, FE>
source§impl<Txn: ThreadSafe, FE: ThreadSafe> Debug for Tensor<Txn, FE>
impl<Txn: ThreadSafe, FE: ThreadSafe> Debug for Tensor<Txn, FE>
source§impl<Txn, FE> From<SparseView<Txn, FE>> for Tensor<Txn, FE>
impl<Txn, FE> From<SparseView<Txn, FE>> for Tensor<Txn, FE>
source§fn from(sparse: SparseView<Txn, FE>) -> Self
fn from(sparse: SparseView<Txn, FE>) -> Self
Converts to this type from the input type.
source§impl<Txn, FE> From<Tensor<Txn, FE>> for Collection<Txn, FE>
impl<Txn, FE> From<Tensor<Txn, FE>> for Collection<Txn, FE>
source§impl<Txn, FE> From<Tensor<Txn, FE>> for TensorView<Txn, FE>
impl<Txn, FE> From<Tensor<Txn, FE>> for TensorView<Txn, FE>
source§impl<Txn, FE> From<TensorBase<Txn, FE>> for Tensor<Txn, FE>
impl<Txn, FE> From<TensorBase<Txn, FE>> for Tensor<Txn, FE>
source§fn from(base: TensorBase<Txn, FE>) -> Tensor<Txn, FE>
fn from(base: TensorBase<Txn, FE>) -> Tensor<Txn, FE>
Converts to this type from the input type.
source§impl<Txn: ThreadSafe, FE: ThreadSafe> Instance for Tensor<Txn, FE>
impl<Txn: ThreadSafe, FE: ThreadSafe> Instance for Tensor<Txn, FE>
source§impl<'en, Txn, FE> IntoView<'en, FE> for Tensor<Txn, FE>
impl<'en, Txn, FE> IntoView<'en, FE> for Tensor<Txn, FE>
§type Txn = Txn
type Txn = Txn
The type of
Transaction
which this state supportssource§impl<State> Route<State> for Tensor<State::Txn, State::FE>where
State: StateInstance + From<Tensor<State::Txn, State::FE>> + From<Tuple<Value>>,
State::Class: From<NumberType>,
State::FE: DenseCacheFile + AsType<Node>,
Number: TryCastFrom<State>,
Tensor<State::Txn, State::FE>: TryCastFrom<State>,
Value: TryCastFrom<State>,
bool: TryCastFrom<State>,
impl<State> Route<State> for Tensor<State::Txn, State::FE>where
State: StateInstance + From<Tensor<State::Txn, State::FE>> + From<Tuple<Value>>,
State::Class: From<NumberType>,
State::FE: DenseCacheFile + AsType<Node>,
Number: TryCastFrom<State>,
Tensor<State::Txn, State::FE>: TryCastFrom<State>,
Value: TryCastFrom<State>,
bool: TryCastFrom<State>,
source§impl<Txn, FE> TensorBoolean<Tensor<Txn, FE>> for Tensor<Txn, FE>
impl<Txn, FE> TensorBoolean<Tensor<Txn, FE>> for Tensor<Txn, FE>
§type LeftCombine = Tensor<Txn, FE>
type LeftCombine = Tensor<Txn, FE>
The result type of a boolean operation which may ignore right-hand values.
source§fn and(self, other: Self) -> TCResult<Self::LeftCombine>
fn and(self, other: Self) -> TCResult<Self::LeftCombine>
Logical and
source§impl<Txn, FE> TensorBooleanConst for Tensor<Txn, FE>
impl<Txn, FE> TensorBooleanConst for Tensor<Txn, FE>
source§impl<Txn, FE> TensorCast for Tensor<Txn, FE>
impl<Txn, FE> TensorCast for Tensor<Txn, FE>
source§impl<Txn, FE> TensorCompare<Tensor<Txn, FE>> for Tensor<Txn, FE>
impl<Txn, FE> TensorCompare<Tensor<Txn, FE>> for Tensor<Txn, FE>
source§impl<Txn, FE> TensorCompareConst for Tensor<Txn, FE>
impl<Txn, FE> TensorCompareConst for Tensor<Txn, FE>
source§impl<Txn, FE> TensorConvert for Tensor<Txn, FE>
impl<Txn, FE> TensorConvert for Tensor<Txn, FE>
source§fn into_dense(self) -> Dense<Txn, FE>
fn into_dense(self) -> Dense<Txn, FE>
Return a dense representation of this
Tensor
.source§fn into_sparse(self) -> Sparse<Txn, FE>
fn into_sparse(self) -> Sparse<Txn, FE>
Return a sparse representation of this
Tensor
.source§impl<Txn, FE> TensorDiagonal for Tensor<Txn, FE>
impl<Txn, FE> TensorDiagonal for Tensor<Txn, FE>
source§impl<Txn: ThreadSafe, FE: ThreadSafe> TensorInstance for Tensor<Txn, FE>
impl<Txn: ThreadSafe, FE: ThreadSafe> TensorInstance for Tensor<Txn, FE>
source§impl<Txn, FE> TensorMatMul<Tensor<Txn, FE>> for Tensor<Txn, FE>
impl<Txn, FE> TensorMatMul<Tensor<Txn, FE>> for Tensor<Txn, FE>
source§impl<Txn, FE> TensorMath<Tensor<Txn, FE>> for Tensor<Txn, FE>
impl<Txn, FE> TensorMath<Tensor<Txn, FE>> for Tensor<Txn, FE>
§type LeftCombine = Tensor<Txn, FE>
type LeftCombine = Tensor<Txn, FE>
The result type of a math operation which may ignore right-hand-side values
source§fn div(self, other: Self) -> TCResult<Self::LeftCombine>
fn div(self, other: Self) -> TCResult<Self::LeftCombine>
Divide
self
by other
.source§fn log(self, base: Self) -> TCResult<Self::LeftCombine>
fn log(self, base: Self) -> TCResult<Self::LeftCombine>
Element-wise logarithm of
self
with respect to the given base
.source§fn mul(self, other: Self) -> TCResult<Self::LeftCombine>
fn mul(self, other: Self) -> TCResult<Self::LeftCombine>
Multiply two tensors together.
source§fn pow(self, other: Self) -> TCResult<Self::LeftCombine>
fn pow(self, other: Self) -> TCResult<Self::LeftCombine>
Raise
self
to the power of other
.source§impl<Txn, FE> TensorMathConst for Tensor<Txn, FE>
impl<Txn, FE> TensorMathConst for Tensor<Txn, FE>
source§impl<Txn, FE> TensorRead for Tensor<Txn, FE>
impl<Txn, FE> TensorRead for Tensor<Txn, FE>
source§impl<Txn, FE> TensorReduce for Tensor<Txn, FE>
impl<Txn, FE> TensorReduce for Tensor<Txn, FE>
source§fn all<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
fn all<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
Return
true
if all elements in this Tensor
are nonzero.source§fn any<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
fn any<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
Return
true
if any element in this Tensor
is nonzero.source§fn max(self, axes: Axes, keepdims: bool) -> TCResult<Self::Reduce>
fn max(self, axes: Axes, keepdims: bool) -> TCResult<Self::Reduce>
Return the maximum of this
Tensor
along the given axis
.source§fn max_all<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<Number>> + Send + 'async_trait>>where
Self: 'async_trait,
fn max_all<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<Number>> + Send + 'async_trait>>where
Self: 'async_trait,
Return the maximum element in this
Tensor
.source§fn min(self, axes: Axes, keepdims: bool) -> TCResult<Self::Reduce>
fn min(self, axes: Axes, keepdims: bool) -> TCResult<Self::Reduce>
Return the minimum of this
Tensor
along the given axis
.source§fn min_all<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<Number>> + Send + 'async_trait>>where
Self: 'async_trait,
fn min_all<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<Number>> + Send + 'async_trait>>where
Self: 'async_trait,
Return the minimum element in this
Tensor
.source§fn product(self, axes: Axes, keepdims: bool) -> TCResult<Self::Reduce>
fn product(self, axes: Axes, keepdims: bool) -> TCResult<Self::Reduce>
Return the product of this
Tensor
along the given axis
.source§fn product_all<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<Number>> + Send + 'async_trait>>where
Self: 'async_trait,
fn product_all<'async_trait>(
self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = TCResult<Number>> + Send + 'async_trait>>where
Self: 'async_trait,
Return the product of all elements in this
Tensor
.source§impl<Txn, FE> TensorTransform for Tensor<Txn, FE>
impl<Txn, FE> TensorTransform for Tensor<Txn, FE>
source§fn broadcast(self, shape: Shape) -> TCResult<Self::Broadcast>
fn broadcast(self, shape: Shape) -> TCResult<Self::Broadcast>
Broadcast this
Tensor
to the given shape
.source§fn expand(self, axes: Axes) -> TCResult<Self::Expand>
fn expand(self, axes: Axes) -> TCResult<Self::Expand>
Insert a new dimension of size 1 at each of the given
axes
.source§impl<Txn, FE> TensorTrig for Tensor<Txn, FE>
impl<Txn, FE> TensorTrig for Tensor<Txn, FE>
source§impl<Txn, FE> TensorUnary for Tensor<Txn, FE>
impl<Txn, FE> TensorUnary for Tensor<Txn, FE>
source§impl<Txn, FE> TensorUnaryBoolean for Tensor<Txn, FE>
impl<Txn, FE> TensorUnaryBoolean for Tensor<Txn, FE>
source§impl<Txn, FE> TensorWrite for Tensor<Txn, FE>
impl<Txn, FE> TensorWrite for Tensor<Txn, FE>
source§impl<Txn, FE> TensorWriteDual<Tensor<Txn, FE>> for Tensor<Txn, FE>
impl<Txn, FE> TensorWriteDual<Tensor<Txn, FE>> for Tensor<Txn, FE>
source§impl<Txn, FE> TryCastFrom<Collection<Txn, FE>> for Tensor<Txn, FE>
impl<Txn, FE> TryCastFrom<Collection<Txn, FE>> for Tensor<Txn, FE>
source§fn can_cast_from(collection: &Collection<Txn, FE>) -> bool
fn can_cast_from(collection: &Collection<Txn, FE>) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(collection: Collection<Txn, FE>) -> Option<Self>
fn opt_cast_from(collection: Collection<Txn, FE>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Auto Trait Implementations§
impl<Txn, FE> !RefUnwindSafe for Tensor<Txn, FE>
impl<Txn, FE> Send for Tensor<Txn, FE>
impl<Txn, FE> Sync for Tensor<Txn, FE>
impl<Txn, FE> Unpin for Tensor<Txn, FE>
impl<Txn, FE> !UnwindSafe for Tensor<Txn, FE>
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
Mutably borrows from an owned value. Read more
source§impl<F> Match for F
impl<F> Match for F
source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<State, T> Public<State> for T
impl<State, T> Public<State> for T
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value
) -> Pin<Box<dyn Future<Output = Result<State, TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value,
value: State
) -> Pin<Box<dyn Future<Output = Result<(), TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn post<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
params: Map<State>
) -> Pin<Box<dyn Future<Output = Result<State, TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value
) -> Pin<Box<dyn Future<Output = Result<(), TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.