pub trait TensorMath<O> {
    type Combine: TensorInstance;
    type LeftCombine: TensorInstance;

    // Required methods
    fn add(self, other: O) -> TCResult<Self::Combine>;
    fn div(self, other: O) -> TCResult<Self::LeftCombine>;
    fn log(self, base: O) -> TCResult<Self::LeftCombine>;
    fn mul(self, other: O) -> TCResult<Self::LeftCombine>;
    fn pow(self, other: O) -> TCResult<Self::LeftCombine>;
    fn sub(self, other: O) -> TCResult<Self::Combine>;
}
Expand description

Tensor math operations

Required Associated Types§

source

type Combine: TensorInstance

The result type of a math operation

source

type LeftCombine: TensorInstance

The result type of a math operation which may ignore right-hand-side values

Required Methods§

source

fn add(self, other: O) -> TCResult<Self::Combine>

Add two tensors together.

source

fn div(self, other: O) -> TCResult<Self::LeftCombine>

Divide self by other.

source

fn log(self, base: O) -> TCResult<Self::LeftCombine>

Element-wise logarithm of self with respect to the given base.

source

fn mul(self, other: O) -> TCResult<Self::LeftCombine>

Multiply two tensors together.

source

fn pow(self, other: O) -> TCResult<Self::LeftCombine>

Raise self to the power of other.

source

fn sub(self, other: O) -> TCResult<Self::Combine>

Subtract other from self.

Implementors§

source§

impl<Txn, FE> TensorMath<DenseView<Txn, FE>> for DenseView<Txn, FE>
where Txn: Transaction<FE>, FE: DenseCacheFile + AsType<Node> + Clone,

§

type Combine = DenseView<Txn, FE>

§

type LeftCombine = DenseView<Txn, FE>

source§

impl<Txn, FE> TensorMath<Tensor<Txn, FE>> for Tensor<Txn, FE>
where Txn: Transaction<FE>, FE: DenseCacheFile + AsType<Node> + Clone,

§

type Combine = Tensor<Txn, FE>

§

type LeftCombine = Tensor<Txn, FE>

source§

impl<Txn, FE> TensorMath<SparseView<Txn, FE>> for SparseView<Txn, FE>
where Txn: Transaction<FE>, FE: DenseCacheFile + AsType<Node>,

§

type Combine = SparseView<Txn, FE>

§

type LeftCombine = SparseView<Txn, FE>

source§

impl<Txn, FE, L, R, T> TensorMath<DenseTensor<Txn, FE, R>> for DenseTensor<Txn, FE, L>
where Txn: ThreadSafe, FE: ThreadSafe, L: DenseInstance<DType = T>, R: DenseInstance<DType = T>, T: CType + DType,

§

type Combine = DenseTensor<Txn, FE, DenseCombine<L, R, T>>

§

type LeftCombine = DenseTensor<Txn, FE, DenseCombine<L, R, T>>

source§

impl<Txn, FE, L, R, T> TensorMath<SparseTensor<Txn, FE, R>> for SparseTensor<Txn, FE, L>
where Txn: Transaction<FE>, FE: AsType<Node> + ThreadSafe, L: SparseInstance<DType = T>, R: SparseInstance<DType = T>, T: CType + DType,

§

type Combine = SparseTensor<Txn, FE, SparseCombine<L, R, T>>

§

type LeftCombine = SparseTensor<Txn, FE, SparseCombineLeft<L, R, T>>