TensorAlgebra

interface TensorAlgebra<T> : Algebra<Tensor<T>>

Algebra over a ring on Tensor. For more information: https://proofwiki.org/wiki/Definition:Algebra_over_Ring

Parameters

T

the type of items in the tensors.

Functions

argMax
Link copied to clipboard
abstract fun Tensor<T>.argMax(dim: Int, keepDim: Boolean): Tensor<T>
Returns the index of maximum value of each row of the input tensor in the given dimension dim.
binaryOperation
Link copied to clipboard
open fun binaryOperation(operation: String, left: Tensor<T>, right: Tensor<T>): Tensor<T>
binaryOperationFunction
Link copied to clipboard
open fun binaryOperationFunction(operation: String): (Tensor<T>, Tensor<T>) -> Tensor<T>
bindSymbol
Link copied to clipboard
open fun bindSymbol(value: String): Tensor<T>
bindSymbolOrNull
Link copied to clipboard
open fun bindSymbolOrNull(value: String): Tensor<T>?
diagonalEmbedding
Link copied to clipboard
abstract fun diagonalEmbedding(diagonalEntries: Tensor<T>, offset: Int = 0, dim1: Int = -2, dim2: Int = -1): Tensor<T>
Creates a tensor whose diagonals of certain 2D planes (specified by dim1 and dim2) are filled by diagonalEntries.
dot
Link copied to clipboard
abstract infix fun Tensor<T>.dot(other: Tensor<T>): Tensor<T>
Matrix product of two tensors.
get
Link copied to clipboard
abstract operator fun Tensor<T>.get(i: Int): Tensor<T>
Returns the tensor at index i For more information: https://pytorch.org/cppdocs/notes/tensor_indexing.
max
Link copied to clipboard
abstract fun Tensor<T>.max(): T
Returns the maximum value of all elements in the input tensor.
abstract fun Tensor<T>.max(dim: Int, keepDim: Boolean): Tensor<T>
Returns the maximum value of each row of the input tensor in the given dimension dim.
min
Link copied to clipboard
abstract fun Tensor<T>.min(): T
abstract fun Tensor<T>.min(dim: Int, keepDim: Boolean): Tensor<T>
Returns the minimum value of each row of the input tensor in the given dimension dim.
minus
Link copied to clipboard
abstract operator fun T.minus(other: Tensor<T>): Tensor<T>
Each element of the tensor other is subtracted from this value.
abstract operator fun Tensor<T>.minus(value: T): Tensor<T>
Subtracts the scalar value from each element of this tensor and returns a new resulting tensor.
abstract operator fun Tensor<T>.minus(other: Tensor<T>): Tensor<T>
Each element of the tensor other is subtracted from each element of this tensor.
minusAssign
Link copied to clipboard
abstract operator fun Tensor<T>.minusAssign(value: T)
Subtracts the scalar value from each element of this tensor.
abstract operator fun Tensor<T>.minusAssign(other: Tensor<T>)
Each element of the tensor other is subtracted from each element of this tensor.
plus
Link copied to clipboard
abstract operator fun T.plus(other: Tensor<T>): Tensor<T>
Each element of the tensor other is added to this value.
abstract operator fun Tensor<T>.plus(value: T): Tensor<T>
Adds the scalar value to each element of this tensor and returns a new resulting tensor.
abstract operator fun Tensor<T>.plus(other: Tensor<T>): Tensor<T>
Each element of the tensor other is added to each element of this tensor.
plusAssign
Link copied to clipboard
abstract operator fun Tensor<T>.plusAssign(value: T)
Adds the scalar value to each element of this tensor.
abstract operator fun Tensor<T>.plusAssign(other: Tensor<T>)
Each element of the tensor other is added to each element of this tensor.
sum
Link copied to clipboard
abstract fun Tensor<T>.sum(): T
abstract fun Tensor<T>.sum(dim: Int, keepDim: Boolean): Tensor<T>
Returns the sum of each row of the input tensor in the given dimension dim.
times
Link copied to clipboard
abstract operator fun T.times(other: Tensor<T>): Tensor<T>
Each element of the tensor other is multiplied by this value.
abstract operator fun Tensor<T>.times(value: T): Tensor<T>
Multiplies the scalar value by each element of this tensor and returns a new resulting tensor.
abstract operator fun Tensor<T>.times(other: Tensor<T>): Tensor<T>
Each element of the tensor other is multiplied by each element of this tensor.
timesAssign
Link copied to clipboard
abstract operator fun Tensor<T>.timesAssign(value: T)
Multiplies the scalar value by each element of this tensor.
abstract operator fun Tensor<T>.timesAssign(other: Tensor<T>)
Each element of the tensor other is multiplied by each element of this tensor.
transpose
Link copied to clipboard
abstract fun Tensor<T>.transpose(i: Int = -2, j: Int = -1): Tensor<T>
Returns a tensor that is a transposed version of this tensor.
unaryMinus
Link copied to clipboard
abstract operator fun Tensor<T>.unaryMinus(): Tensor<T>
Numerical negative, element-wise.
unaryOperation
Link copied to clipboard
open fun unaryOperation(operation: String, arg: Tensor<T>): Tensor<T>
unaryOperationFunction
Link copied to clipboard
open fun unaryOperationFunction(operation: String): (Tensor<T>) -> Tensor<T>
value
Link copied to clipboard
abstract fun Tensor<T>.value(): T
Returns a single tensor value of unit dimension.
valueOrNull
Link copied to clipboard
abstract fun Tensor<T>.valueOrNull(): T?
Returns a single tensor value of unit dimension if tensor shape equals to 1.
view
Link copied to clipboard
abstract fun Tensor<T>.view(shape: IntArray): Tensor<T>
Returns a new tensor with the same data as the self tensor but of a different shape.
viewAs
Link copied to clipboard
abstract fun Tensor<T>.viewAs(other: Tensor<T>): Tensor<T>
View this tensor as the same size as other.

Inheritors

TensorPartialDivisionAlgebra
Link copied to clipboard