IntTensorAlgebra

Implementation of basic operations over double tensors and basic algebra operations on them.

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard

Functions

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

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

Link copied to clipboard
open override fun StructureND<Int>.argMin(dim: Int, keepDim: Boolean): Tensor<Int>

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

Link copied to clipboard
open fun binaryOperation(operation: String, left: StructureND<Int>, right: StructureND<Int>): StructureND<Int>
Link copied to clipboard
open override fun binaryOperationFunction(operation: String): (left: StructureND<Int>, right: StructureND<Int>) -> StructureND<Int>
Link copied to clipboard
open fun bindSymbol(value: String): StructureND<Int>
Link copied to clipboard
Link copied to clipboard
open override fun diagonalEmbedding(diagonalEntries: StructureND<Int>, offset: Int, dim1: Int, dim2: Int): IntTensor

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
open infix override fun StructureND<Int>.dot(other: StructureND<Int>): IntTensor

Matrix product of two tensors.

Link copied to clipboard
fun Tensor<Int>.eq(other: Tensor<Int>): Boolean

Compares element-wise two int tensors

Link copied to clipboard
Link copied to clipboard
fun eye(n: Int): IntTensor

Returns a 2D tensor with shape (n, n), with ones on the diagonal and zeros elsewhere.

Link copied to clipboard
fun fromArray(shape: ShapeND, array: IntArray): IntTensor

Constructs a tensor with the specified shape and data.

Link copied to clipboard
fun full(value: Int, shape: ShapeND): IntTensor

Creates a tensor of a given shape and fills all elements with a given value.

Link copied to clipboard
fun fullLike(structureND: StructureND<*>, value: Int): IntTensor

Returns a tensor with the same shape as input filled with value.

Link copied to clipboard
open fun <F : StructureFeature> getFeature(structure: StructureND<Int>, type: KClass<out F>): F?
Link copied to clipboard
open fun Tensor<Int>.getTensor(first: Int, second: Int): Tensor<Int>

open override fun Tensor<Int>.getTensor(i: Int): IntTensor

Returns the tensor at index i For more information: https://pytorch.org/cppdocs/notes/tensor_indexing.html

Link copied to clipboard
open operator fun (Int) -> Int.invoke(structure: StructureND<Int>): StructureND<Int>
Link copied to clipboard
inline override fun StructureND<Int>.map(transform: IntRing.(Int) -> Int): IntTensor

Applies the transform function to each element of the tensor and returns the resulting modified tensor.

Link copied to clipboard
inline override fun StructureND<Int>.mapIndexed(transform: IntRing.(index: IntArray, Int) -> Int): IntTensor
Link copied to clipboard
inline fun Tensor<Int>.mapIndexedInPlace(operation: (IntArray, Int) -> Int)
Link copied to clipboard
inline fun Tensor<Int>.mapInPlace(operation: (Int) -> Int)
Link copied to clipboard
open override fun StructureND<Int>.max(): Int

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

open override fun StructureND<Int>.max(dim: Int, keepDim: Boolean): IntTensor

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

Link copied to clipboard
Link copied to clipboard
open override fun StructureND<Int>.min(): Int

open override fun StructureND<Int>.min(dim: Int, keepDim: Boolean): IntTensor

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

Link copied to clipboard
open operator override fun Int.minus(arg: StructureND<Int>): IntTensor

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

open operator override fun StructureND<Int>.minus(arg: Int): IntTensor

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

open operator override fun StructureND<Int>.minus(arg: StructureND<Int>): IntTensor

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

Link copied to clipboard
open operator override fun Tensor<Int>.minusAssign(value: Int)

Subtracts the scalar value from each element of this tensor.

open operator override fun Tensor<Int>.minusAssign(arg: StructureND<Int>)

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

Link copied to clipboard
open override fun multiply(left: StructureND<Int>, right: StructureND<Int>): Tensor<Int>
Link copied to clipboard
fun ones(shape: ShapeND): IntTensor

Returns a tensor filled with the scalar value 1, with the shape defined by the variable argument shape.

Link copied to clipboard
fun onesLike(structureND: Tensor<*>): IntTensor

Returns a tensor filled with the scalar value 1, with the same shape as a given array.

Link copied to clipboard
open operator override fun Int.plus(arg: StructureND<Int>): IntTensor

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

open operator override fun StructureND<Int>.plus(arg: Int): IntTensor

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

open operator override fun StructureND<Int>.plus(arg: StructureND<Int>): IntTensor

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

Link copied to clipboard
open operator override fun Tensor<Int>.plusAssign(value: Int)

Adds the scalar value to each element of this tensor.

open operator override fun Tensor<Int>.plusAssign(arg: StructureND<Int>)

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

Link copied to clipboard
inline fun StructureND<Int>.reduceElements(transform: (IntBuffer) -> Int): Int
Link copied to clipboard

Builds tensor from rows of the input tensor.

Link copied to clipboard
fun stack(tensors: List<Tensor<Int>>): IntTensor

Concatenates a sequence of tensors with equal shapes along the first dimension.

Link copied to clipboard
open override fun structureND(shape: ShapeND, initializer: IntRing.(IntArray) -> Int): IntTensor

Constructs a tensor with the specified shape and initializer.

Link copied to clipboard
open override fun StructureND<Int>.sum(): Int

open override fun StructureND<Int>.sum(dim: Int, keepDim: Boolean): IntTensor

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

Link copied to clipboard
open operator override fun Int.times(arg: StructureND<Int>): IntTensor

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

open operator override fun StructureND<Int>.times(arg: Int): IntTensor

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

open operator override fun StructureND<Int>.times(arg: StructureND<Int>): IntTensor

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

Link copied to clipboard
open operator override fun Tensor<Int>.timesAssign(value: Int)

Multiplies the scalar value by each element of this tensor.

open operator override fun Tensor<Int>.timesAssign(arg: StructureND<Int>)

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

Link copied to clipboard
open override fun StructureND<Int>.transposed(i: Int, j: Int): Tensor<Int>

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
open operator override fun StructureND<Int>.unaryMinus(): IntTensor

Numerical negative, element-wise.

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

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

Link copied to clipboard
open override fun StructureND<Int>.valueOrNull(): Int?

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

Link copied to clipboard
open override fun Tensor<Int>.view(shape: ShapeND): IntTensor

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
open override fun Tensor<Int>.viewAs(other: StructureND<Int>): IntTensor

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
fun zeroesLike(structureND: StructureND<Int>): IntTensor

Returns a tensor filled with the scalar value 0, with the same shape as a given array.

Link copied to clipboard
fun zeros(shape: ShapeND): IntTensor

Returns a tensor filled with the scalar value 0, with the shape defined by the variable argument shape.

Link copied to clipboard
inline override fun zip(left: StructureND<Int>, right: StructureND<Int>, transform: IntRing.(Int, Int) -> Int): IntTensor

Properties

Link copied to clipboard
Link copied to clipboard
open override val elementAlgebra: IntRing