Methods
# inner createTwoDimensionTensor(values, shape, dataType) → {Tensor}
Creates rank-2 tf.Tensor with the provided values, shape and dtype.
Parameters:
Name | Type | Description |
---|---|---|
values |
Array.<number>
|
The values of the tensor. Can be nested array of numbers, or a flat array, or a TypedArray. |
shape |
Array.<number>
|
The shape of the tensor. If not provided, it is inferred from values. |
dataType |
Enumerator
|
('float32'|'int32') The data type. |
tf.tensor2d(values, shape, 'dataType').
Tensor
# inner createVectorTensor(values, dataType) → {Tensor}
Creates rank-1 tf.Tensor with the provided values, shape and dtype.
Parameters:
Name | Type | Description |
---|---|---|
values |
Array.<number>
|
The values of the tensor. Can be array of numbers, or a TypedArray. |
dataType |
Enumerator
|
('float32'|'int32') The data type. |
tf.tensor1d(values, 'dataType').
Tensor
# inner zeros(shape, dataType) → {Tensor}
Creates a tf.Tensor with all elements set to 0.
Parameters:
Name | Type | Description |
---|---|---|
shape |
Array.<number>
|
An array of integers defining the output tensor shape. |
dataType |
Enumerator
|
('float32'|'int32') The data type. |
tf.zeros(shape, 'dataType').
Tensor
# inner zerosLike(tensor) → {Tensor}
Creates a tf.Tensor with all elements set to 0 with the same shape as the given tensor.
Parameters:
Name | Type | Description |
---|---|---|
tensor |
Tensor
|
The tensor of required shape. |
tf.zerosLike(tensor).
Tensor