TensorShape

class TensorShape

Representation of the tensor shape class with helper methods.

Constructors

TensorShape
Link copied to clipboard
fun TensorShape(dims: LongArray)

Creates a new TensorShape with the given dimensions.

TensorShape
Link copied to clipboard
fun TensorShape(firstDimension: Long, vararg dims: Long)

Creates a new TensorShape with the given dimensions.

TensorShape
Link copied to clipboard
fun TensorShape()

Types

Companion
Link copied to clipboard
object Companion

Functions

almostEqual
Link copied to clipboard
fun almostEqual(tensorShape: TensorShape, except: Int): Boolean

Check the fact that two shapes has the same values at the same dimensions except one with index except.

assertKnown
Link copied to clipboard
fun assertKnown(i: Int)

Throw an exception if dimension i is unknown.

clone
Link copied to clipboard
fun clone(): TensorShape

Makes a copy of TensorShape object.

concatenate
Link copied to clipboard
fun concatenate(vararg dims: Long): TensorShape

Augment this TensorShape by appending more dimensions to it.

dims
Link copied to clipboard
fun dims(): LongArray

Returns the array of dimensions representing this shape.

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
get
Link copied to clipboard
operator fun get(i: Int): Long

Returns the value of a dimension

hashCode
Link copied to clipboard
open override fun hashCode(): Int
head
Link copied to clipboard
fun head(): Long

Returns the head dimension.

numElements
Link copied to clipboard
fun numElements(): Long

Returns amount of elements in Tensor with the given shape.

rank
Link copied to clipboard
fun rank(): Int

Returns the rank of this shape.

replace
Link copied to clipboard
fun replace(i: Int, dim: Long): TensorShape

Replace dimension i with a new dimension size.

replaceFirst
Link copied to clipboard
fun replaceFirst(dim: Long): TensorShape

Replace the first dimension with a new dimension size.

replaceLast
Link copied to clipboard
fun replaceLast(dim: Long): TensorShape

Replace the last dimension with a new dimension size.

set
Link copied to clipboard
operator fun set(i: Int, value: Long)

Sets the value of a dimension

size
Link copied to clipboard
fun size(i: Int): Long

Get the size of a target dimension.

tail
Link copied to clipboard
fun tail(): LongArray

Returns the tail dimension.

toString
Link copied to clipboard
open override fun toString(): String