Class

Tensor

Tensor(dim, array)

Represents a multi dimensional number object

Constructor

# new Tensor(dim, array)

Parameters:
Name Type Description
dim Array.<number>

The dimension of the Tensor

array Array.<any>

The actual managed array element

Implements:

View Source core/src/Utils/Tensor.ts, line 24

Members

Array.<number>

# dim

Returns the Dimension of the Tensor

View Source core/src/Utils/Tensor.ts, line 88

number

# mean

Returns the Mean of the Tensor

View Source core/src/Utils/Tensor.ts, line 74

Array.<any>

# seeArray

See the contained array

View Source core/src/Utils/Tensor.ts, line 95

number

# size

Get the total size of the tensor

View Source core/src/Utils/Tensor.ts, line 102

number

# sum

Get the total sum of the tensor

View Source core/src/Utils/Tensor.ts, line 81

Methods

# copy() → {Tensor}

Create a copy of the Tensor

Implements:

View Source core/src/Utils/Tensor.ts, line 419

The copy

Tensor

# dim() → {Array}

Returns the Dimension of the Tensor

View Source core/src/Utils/Tensor.ts, line 379

Array

# get(indices) → {Array.<any>|number}

Get a certain index of the array.

Parameters:
Name Type Description
indices Array.<number>

The Tensor index to return

View Source core/src/Utils/Tensor.ts, line 403

The digit or sub array

Array.<any> | number

# isEqual(comp) → {boolean}

is Tensor equal

Parameters:
Name Type Description
comp Tensor
Implements:

View Source core/src/Utils/Tensor.ts, line 434

Whether it is equal

boolean

# mean() → {number}

Returns the Mean of the Tensor

View Source core/src/Utils/Tensor.ts, line 363

number

# seeArray() → {Array.<any>}

See the contained array

View Source core/src/Utils/Tensor.ts, line 387

Array.<any>

# set(indices, value) → {void}

Set the value at a certain index

Parameters:
Name Type Description
indices Array.<number>

The indices of the position

value Array.<any> | number

The new value of the index

View Source core/src/Utils/Tensor.ts, line 412

void

# size() → {number}

Get the total size of the tensor

View Source core/src/Utils/Tensor.ts, line 395

number

# sum() → {number}

Get the total sum of the tensor

View Source core/src/Utils/Tensor.ts, line 371

number

# toJSONTensor() → {JSONTensor}

Convert to JSONTensor

View Source core/src/Utils/Tensor.ts, line 426

The Tensor in JSONTensor Format

JSONTensor

# toString() → {string}

Returns the Tensor as a string object

View Source core/src/Utils/Tensor.ts, line 441

The stringified Tensor

string

# static Ones(dims) → {Tensor}

Static function to initialize an Tensor filled with Ones

Parameters:
Name Type Description
dims Array.<number>

The dimensions of the Tensor to initialize

View Source core/src/Utils/Tensor.ts, line 338

a filled Tensor

Tensor

# static Random(dims, randomSeednullable) → {Tensor}

Static function to initialize an Tensor filled with random number in the range of [0<=x<=1]

Parameters:
Name Type Attributes Description
dims Array.<number>

The dimensions of the Tensor to initialize

randomSeed number <nullable>

random seed to used for random number generator

View Source core/src/Utils/Tensor.ts, line 347

a filled Tensor

Tensor

# static Zeros(dims) → {Tensor}

Static function to initialize an Tensor filled with Zeros

Parameters:
Name Type Description
dims Array.<number>

The dimensions of the Tensor to initialize

View Source core/src/Utils/Tensor.ts, line 330

a filled Tensor

Tensor

# static fromJSONObject(jsonTensor) → {Tensor}

Convert JSONTensor to actual Tensor

Parameters:
Name Type Description
jsonTensor JSONTensor

json tensor to convert

View Source core/src/Utils/Tensor.ts, line 355

  • the converted Tensor
Tensor