PrintedTensor

class PrintedTensor(printed: String, shape: Shape) : TracingTensor

This class is used when "printing" complex data structures by tracingPrintedForm. Tracing tensors are replaced by an instance of this class to hold the printed form.

Constructors

PrintedTensor
Link copied to clipboard
fun PrintedTensor(printed: String, shape: Shape)

Functions

accept
Link copied to clipboard
open override fun <R> accept(v: TracingVisitor<R>): R
floatEval
Link copied to clipboard
open fun floatEval(vars: FloatArray): Float
get
Link copied to clipboard
open operator fun get(index: Int): DTensor
open operator fun get(vararg indices: Int): DTensor
toCodeString
Link copied to clipboard
open fun toCodeString(): String
toString
Link copied to clipboard
open override fun toString(): String
wrap
Link copied to clipboard
open override fun wrap(wrapper: Wrapper): DTensor

Wrapper around the tensor

Properties

derivativeID
Link copied to clipboard
open override val derivativeID: NoDerivativeID

Each derivative is assigned a unique DerivativeID

indices
Link copied to clipboard
open val indices: Iterator<IntArray>

An iterator over the indices for the tensor

isScalar
Link copied to clipboard
open val isScalar: Boolean

True if the tensor is a scalar.

operations
Link copied to clipboard
open override val operations: Operations

The operations available on a tensor.

primal
Link copied to clipboard
open override val primal: PrintedTensor

primal points to the actual tensor

printed
Link copied to clipboard
val printed: String
rank
Link copied to clipboard
open val rank: Int

The number of dimensions in the tensor's shape. rank 0 - Scalar rank 1 - 1D array or 1D tensor rank 2 - 2D matrix or 2D tensor rank 3 - 3D tensor ... rank N - ND tensor

shape
Link copied to clipboard
open override val shape: Shape

shape indicates the number of dimension of a tensor and the length of each dimension. If the shape of the tensor is 3x4x5 then the value of shape is Shape(3,4,5).

size
Link copied to clipboard
open val size: Int

The total number of elements of this tensor.