Slice

class Slice(content: TensorContent, range: IntRange)

A handy class to easily read a range of the tensor's content.

Parameters

content

the tensor content.

range

which range of tensor's content will be read.

Constructors

Link copied to clipboard
constructor(content: TensorContent, range: IntRange)

Functions

Link copied to clipboard
fun asByteArray(): ByteArray

Ready the selected range from the tensor as Bytes. The tensor must be a of Tensor.DataType.INT8, otherwise you cannot read its content as ByteArray.

Link copied to clipboard
fun asDoubleArray(): DoubleArray

Ready the selected range from the tensor as doubles. The tensor must be a of Tensor.DataType.FLOAT64, otherwise you cannot read its content as DoubleArray.

Link copied to clipboard
fun asFloatArray(): FloatArray

Ready the selected range from the tensor as floats. The tensor must be a of Tensor.DataType.FLOAT32, otherwise you cannot read its content as FloatArray.

Link copied to clipboard
fun asIntArray(): IntArray

Ready the selected range from the tensor as integers. The tensor must be a of Tensor.DataType.INT32, otherwise you cannot read its content as IntArray.

Link copied to clipboard
fun asShortArray(): ShortArray

Ready the selected range from the tensor as Shorts. The tensor must be a of Tensor.DataType.INT16, otherwise you cannot read its content as ShortArray.