TensorAlgebra

interface TensorAlgebra<T, A : Ring<T>> : RingOpsND<T, A>

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

Link copied to clipboard
open override fun add(left: StructureND<T>, right: StructureND<T>): Tensor<T>
Link copied to clipboard
abstract fun StructureND<T>.argMax(dim: Int, keepDim: Boolean): Tensor<Int>

Returns the index of maximum value of each row of the input tensor in the given dimension dim.

Link copied to clipboard
open fun binaryOperation(operation: String, left: StructureND<T>, right: StructureND<T>): StructureND<T>
Link copied to clipboard
open override fun binaryOperationFunction(operation: String): (left: StructureND<T>, right: StructureND<T>) -> StructureND<T>
Link copied to clipboard
open fun bindSymbol(value: String): StructureND<T>
Link copied to clipboard
open fun bindSymbolOrNull(value: String): StructureND<T>?
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. To facilitate creating batched diagonal matrices, the 2D planes formed by the last two dimensions of the returned tensor are chosen by default.

Link copied to clipboard
abstract infix fun StructureND<T>.dot(other: StructureND<T>): Tensor<T>

Matrix product of two tensors.

Link copied to clipboard
open fun export(arg: StructureND<T>): StructureND<T>
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.html

Link copied to clipboard
open fun <F : StructureFeature> getFeature(structure: StructureND<T>, type: KClass<out F>): F?
Link copied to clipboard
open operator fun (T) -> T.invoke(structure: StructureND<T>): StructureND<T>
Link copied to clipboard
open fun StructureND<T>.map(transform: A.(T) -> T): StructureND<T>
Link copied to clipboard
open fun StructureND<T>.mapIndexed(transform: A.(index: IntArray, T) -> T): StructureND<T>
Link copied to clipboard
abstract fun StructureND<T>.max(): T?

Returns the maximum value of all elements in the input tensor or null if there are no values

abstract fun StructureND<T>.max(dim: Int, keepDim: Boolean): Tensor<T>

Returns the maximum value of each row of the input tensor in the given dimension dim.

Link copied to clipboard
abstract fun StructureND<T>.min(): T?

abstract fun StructureND<T>.min(dim: Int, keepDim: Boolean): Tensor<T>

Returns the minimum value of each row of the input tensor in the given dimension dim.

Link copied to clipboard
abstract operator override fun T.minus(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is subtracted from this value. The resulting tensor is returned.

abstract operator override fun StructureND<T>.minus(arg: T): Tensor<T>

Subtracts the scalar arg from each element of this tensor and returns a new resulting tensor.

abstract operator override fun StructureND<T>.minus(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is subtracted from each element of this tensor. The resulting tensor is returned.

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(arg: StructureND<T>)

Each element of the tensor arg is subtracted from each element of this tensor.

Link copied to clipboard
open override fun multiply(left: StructureND<T>, right: StructureND<T>): Tensor<T>
Link copied to clipboard
abstract operator override fun T.plus(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is added to this value. The resulting tensor is returned.

abstract operator override fun StructureND<T>.plus(arg: T): Tensor<T>

Adds the scalar arg to each element of this tensor and returns a new resulting tensor.

abstract operator override fun StructureND<T>.plus(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is added to each element of this tensor. The resulting tensor is returned.

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(arg: StructureND<T>)

Each element of the tensor arg is added to each element of this tensor.

Link copied to clipboard
abstract fun structureND(shape: Shape, initializer: A.(IntArray) -> T): StructureND<T>
Link copied to clipboard
abstract fun StructureND<T>.sum(): T

abstract fun StructureND<T>.sum(dim: Int, keepDim: Boolean): Tensor<T>

Returns the sum of each row of the input tensor in the given dimension dim.

Link copied to clipboard
abstract operator override fun T.times(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is multiplied by this value. The resulting tensor is returned.

abstract operator override fun StructureND<T>.times(arg: T): Tensor<T>

Multiplies the scalar arg by each element of this tensor and returns a new resulting tensor.

abstract operator override fun StructureND<T>.times(arg: StructureND<T>): Tensor<T>

Each element of the tensor arg is multiplied by each element of this tensor. The resulting tensor is returned.

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(arg: StructureND<T>)

Each element of the tensor arg is multiplied by each element of this tensor.

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. The given dimensions i and j are swapped. For more information: https://pytorch.org/docs/stable/generated/torch.transpose.html

Link copied to clipboard
abstract operator override fun StructureND<T>.unaryMinus(): Tensor<T>

Numerical negative, element-wise.

Link copied to clipboard
open fun unaryOperation(operation: String, arg: StructureND<T>): StructureND<T>
Link copied to clipboard
open override fun unaryOperationFunction(operation: String): (arg: StructureND<T>) -> StructureND<T>
Link copied to clipboard
open operator fun StructureND<T>.unaryPlus(): StructureND<T>
Link copied to clipboard
open fun StructureND<T>.value(): T

Returns a single tensor value of unit dimension. The tensor shape must be equal to 1.

Link copied to clipboard
abstract fun StructureND<T>.valueOrNull(): T?

Returns a single tensor value of unit dimension if tensor shape equals to 1.

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. The returned tensor shares the same data and must have the same number of elements, but may have a different size For more information: https://pytorch.org/docs/stable/tensor_view.html

Link copied to clipboard
abstract fun Tensor<T>.viewAs(other: StructureND<T>): Tensor<T>

View this tensor as the same size as other. this.viewAs(other) is equivalent to this.view(other.shape). For more information: https://pytorch.org/cppdocs/notes/tensor_indexing.html

Link copied to clipboard
open fun zip(left: StructureND<T>, right: StructureND<T>, transform: A.(T, T) -> T): StructureND<T>

Properties

Link copied to clipboard
abstract val elementAlgebra: A

Inheritors

Link copied to clipboard

Sources

Link copied to clipboard