FloatScalar

class FloatScalar(value: Float) : FloatTensor, DScalar

A differentiable tensor of rank 0 containing a single float (a FloatTensor wrapper around a float).

Constructors

FloatScalar
Link copied to clipboard
fun FloatScalar(value: Float)

Creates a FloatScalar initialized to value.

Types

Companion
Link copied to clipboard
object Companion

Functions

all
Link copied to clipboard
open fun all(p: (Float) -> Boolean): Boolean
asList
Link copied to clipboard
fun asList(): List<Float>
asStrided
Link copied to clipboard
fun asStrided(): StridedFloatTensor
at
Link copied to clipboard
open override fun at(pos: Int): Float
cpu
Link copied to clipboard
open fun cpu(): FloatTensor
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
get
Link copied to clipboard
open operator fun get(index: Int): DTensor
open operator fun get(vararg indices: Int): DTensor
gpu
Link copied to clipboard
fun gpu(): GpuFloatTensor
hashCode
Link copied to clipboard
open override fun hashCode(): Int
impureMap
Link copied to clipboard
open fun impureMap(f: (Float) -> Float): FloatTensor

map for when the function is not pure.

impureZip
Link copied to clipboard
open fun impureZip(right: FloatTensor, f: (Float, Float) -> Float): FloatTensor

zip for when the function is not pure.

impureZip2
Link copied to clipboard
open fun impureZip2(second: FloatTensor, third: FloatTensor, f: (Float, Float, Float) -> Float): FloatTensor

zip2 for when the function is not pure.

map
Link copied to clipboard
open override fun map(f: (Float) -> Float): FloatScalar
mapIndexed
Link copied to clipboard
open fun mapIndexed(f: (Int, Float) -> Float): FloatTensor
normalize
Link copied to clipboard
open fun normalize(): StridedFloatTensor

Return an equivalent tensor whose representation is a StridedFloatTensor with natural layout and zero offset (that is, with a contiguous data representation).

posToIndex
Link copied to clipboard
fun posToIndex(contig: Int): IntArray

Computes the tensor index corresponding to the position in normal form.

reduce
Link copied to clipboard
fun reduce(f: (Float, Float) -> Float, axes: IntArray = allAxes, keepDims: Boolean = false): FloatTensor
to
Link copied to clipboard
fun to(device: Device): FloatTensor
toCodeString
Link copied to clipboard
open override 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

zip
Link copied to clipboard
open fun zip(right: FloatTensor, f: (Float, Float) -> Float): FloatTensor
zip2
Link copied to clipboard
open fun zip2(second: FloatTensor, third: FloatTensor, f: (Float, Float, Float) -> Float): FloatTensor

Properties

allAxes
Link copied to clipboard
val allAxes: IntArray
derivativeID
Link copied to clipboard
open override val derivativeID: DerivativeID

Each derivative is assigned a unique DerivativeID

device
Link copied to clipboard
val device: Device
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: DScalar

primal points to the actual tensor

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.

value
Link copied to clipboard
val value: Float

The floating point number to wrap with a FloatTensor.

Extensions

compareTo
Link copied to clipboard
operator fun FloatScalar.compareTo(right: Float): Int
operator fun FloatScalar.compareTo(right: FloatScalar): Int