An operator producing a constant value.
All endpoints of this operator are named `constant`, except those accepting vararg elements in parameter, which are named `array`. For example:
Ops tf = Ops.create();
tf.constant(1.0f); // mapped to Constant.scalarOf(scope, float);
tf.constant(new float[] {1.0f, 2.0f); // mapped to Constant.vectorOf(scope, float[])
tf.constant(new float[][] { {1.0f, 2.0f}, {3.0f, 4.0f} }); //mapped to Constant.tensorOf(scope, float[][])
tf.array(1.0f, 2.0f, 3.0f); // mapped to Constant.arrayOf(scope, float...)
}Public Methods
| static Constant<TString> | |
| static Constant<TInt32> | |
| static Constant<TInt64> | |
| static Constant<TString> | |
| static Constant<TUint8> | |
| static Constant<TFloat32> | |
| static Constant<TBool> | |
| static Constant<TFloat64> | |
| Output<T> |
asOutput()
Returns the symbolic handle of the tensor.
|
| static <T extends TType> Constant<T> | |
| static Constant<TFloat32> | |
| static Constant<TUint8> | |
| static Constant<TString> | |
| static Constant<TFloat64> | |
| static Constant<TInt32> | |
| static Constant<TBool> | |
| static Constant<TString> | |
| static Constant<TInt64> | |
| static Constant<TBool> | |
| static Constant<TFloat64> | |
| static Constant<TString> | |
| static Constant<TUint8> | |
| static Constant<TInt32> | |
| static Constant<TInt32> |
tensorOf(Scope scope, Shape shape, IntDataBuffer data)
Create a
TInt32 constant with data from the given buffer. |
| static Constant<TInt64> | |
| static Constant<TInt64> |
tensorOf(Scope scope, Shape shape, LongDataBuffer data)
Create a
TInt64 constant with data from the given buffer. |
| static Constant<TFloat32> | |
| static Constant<TBool> | |
| static Constant<TString> | |
| static Constant<TInt64> | |
| static Constant<TInt64> | |
| static Constant<TInt32> | |
| static Constant<TString> |
tensorOf(Scope scope, Shape shape, DataBuffer<String> data)
Create a
TString constant with data from the given buffer, using the default UTF-8
encoding. |
| static Constant<TBool> | |
| static Constant<TInt32> | |
| static Constant<TFloat64> |
tensorOf(Scope scope, DoubleNdArray data)
Creates a constant of
double elements that is a copy of a given n-dimensional array. |
| static Constant<TString> | |
| static <T extends TType> Constant<T> |
tensorOf(Scope scope, Class<T> type, Shape shape, ByteDataBuffer data)
Create a constant with data from the given buffer.
|
| static Constant<TString> |
tensorOf(Scope scope, Charset charset, Shape shape, DataBuffer<String> data)
Create a
TString constant with data from the given buffer, using the given encoding. |
| static Constant<TFloat64> | |
| static Constant<TFloat32> |
tensorOf(Scope scope, FloatNdArray data)
Creates a constant of
float elements that is a copy of a given n-dimensional array. |
| static Constant<TBool> | |
| static <T extends TNumber> Constant<T> | |
| static Constant<TUint8> |
tensorOf(Scope scope, ByteNdArray data)
Creates a constant of
byte elements that is a copy of a given n-dimensional array. |
| static Constant<TBool> |
tensorOf(Scope scope, Shape shape, BooleanDataBuffer data)
Create a
TBool constant with data from the given buffer. |
| static Constant<TFloat32> | |
| static Constant<TUint8> | |
| static Constant<TFloat32> |
tensorOf(Scope scope, Shape shape, FloatDataBuffer data)
Create a
TFloat32 constant with data from the given buffer. |
| static Constant<TBool> |
tensorOf(Scope scope, BooleanNdArray data)
Creates a constant of
boolean elements that is a copy of a given n-dimensional array. |
| static Constant<TInt64> | |
| static Constant<TFloat32> | |
| static Constant<TUint8> |
tensorOf(Scope scope, Shape shape, ByteDataBuffer data)
Create a
TUint8 constant with data from the given buffer. |
| static Constant<TString> | |
| static Constant<TUint8> | |
| static Constant<TFloat64> | |
| static Constant<TString> | |
| static Constant<TFloat64> |
tensorOf(Scope scope, Shape shape, DoubleDataBuffer data)
Create a
TFloat64 constant with data from the given buffer. |
| static Constant<TInt64> | |
| static Constant<TBool> | |
| static Constant<TFloat32> | |
| static Constant<TUint8> | |
| static Constant<TString> | |
| static Constant<TInt64> | |
| static Constant<TUint8> | |
| static Constant<TFloat32> | |
| static Constant<TInt32> | |
| static Constant<TInt32> |
tensorOf(Scope scope, IntNdArray data)
Creates a constant of
int elements that is a copy of a given n-dimensional array. |
| static Constant<TInt32> | |
| static Constant<TFloat64> | |
| static Constant<TInt64> |
tensorOf(Scope scope, LongNdArray data)
Creates a constant of
long elements that is a copy of a given n-dimensional array. |
| static Constant<TString> | |
| static Constant<TFloat64> | |
| static <T extends TNumber> Constant<T> |
tensorOfSameType(Scope scope, Operand<T> toMatch, Number number)
Creates a scalar of the same type as
toMatch, with the value of number. |
| static Constant<TUint8> | |
| static Constant<TInt64> | |
| static Constant<TFloat64> | |
| static Constant<TInt32> | |
| static Constant<TString> | |
| static Constant<TFloat32> | |
| static Constant<TBool> | |
| static Constant<TString> |
Inherited Methods
Public Methods
public static Constant<TString> arrayOf (Scope scope, Charset charset, String... data)
Creates a constant of String elements, using the given charset.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| charset | charset for encoding/decoding strings bytes. |
| data | An array containing the values to put into the new constant. String elements are sequences of bytes from the last array dimension. |
Returns
- the
Stringconstant
public static Constant<TInt32> arrayOf (Scope scope, int... data)
Creates a constant of int elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a float constant
public static Constant<TInt64> arrayOf (Scope scope, long... data)
Creates a constant of long elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a long constant
public static Constant<TString> arrayOf (Scope scope, String... data)
Creates a constant of String elements, using the default UTF-8 charset.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- the
Stringconstant
public static Constant<TUint8> arrayOf (Scope scope, byte... data)
Creates a constant of byte elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a byte constant
public static Constant<TFloat32> arrayOf (Scope scope, float... data)
Creates a constant of float elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a float constant
public static Constant<TBool> arrayOf (Scope scope, boolean... data)
Creates a constant of boolean elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a boolean constant
public static Constant<TFloat64> arrayOf (Scope scope, double... data)
Creates a constant of double elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a double constant
public Output<T> asOutput ()
Returns the symbolic handle of the tensor.
Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.
public static Constant<T> create (Scope scope, T tensor)
Create a constant by making an immutable copy of tensor. tensor may be closed afterwards without
issue.
Note: this endpoint cannot be simply called constant since it will conflict with
other endpoints accepting an NdArray in parameter {e.g. tensorOf(Scope, FloatNdArray)}.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| tensor | a Tensor holding the constant value |
Returns
- a constant of the same data type as `tensor`
public static Constant<TFloat32> scalarOf (Scope scope, float data)
Creates a constant containing a single float element.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | The value to put into the new constant. |
Returns
- a float constant
public static Constant<TUint8> scalarOf (Scope scope, byte data)
Creates a constant containing a single byte element.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | The value to put into the new constant. |
Returns
- a byte constant
public static Constant<TString> scalarOf (Scope scope, Charset charset, String data)
Creates a String constant using a specified encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| charset | The encoding from String to bytes. |
| data | The string to put into the new constant. |
Returns
- a string constant
public static Constant<TFloat64> scalarOf (Scope scope, double data)
Creates a constant containing a single double element.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | The value to put into the new constant. |
Returns
- a double constant
public static Constant<TInt32> scalarOf (Scope scope, int data)
Creates a constant containing a single int element.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | The value to put into the new constant. |
Returns
- an integer constant
public static Constant<TBool> scalarOf (Scope scope, boolean data)
Creates a constant containing a single boolean element.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | The value to put into the new constant. |
Returns
- a boolean constant
public static Constant<TString> scalarOf (Scope scope, String data)
Creates a String constant using the default, UTF-8 encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | The string to put into the new constant. |
Returns
- a string constant
public static Constant<TInt64> scalarOf (Scope scope, long data)
Creates a constant containing a single long element.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | The value to put into the new constant. |
Returns
- a long constant
public static Constant<TBool> tensorOf (Scope scope, boolean[][][][][][] data)
Creates a rank-6 constant of boolean elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a boolean constant
public static Constant<TFloat64> tensorOf (Scope scope, double[][][] data)
Creates a rank-3 constant of double elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a double constant
public static Constant<TString> tensorOf (Scope scope, String[][][][][][] data)
Creates a rank-6 constant of String elements, using default UTF-8 encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a
TStringconstant matrix
public static Constant<TUint8> tensorOf (Scope scope, byte[][][][] data)
Creates a rank-4 constant of byte elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a byte constant
public static Constant<TInt32> tensorOf (Scope scope, int[][] data)
Creates a rank-2 constant of int elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- an integer constant
public static Constant<TInt32> tensorOf (Scope scope, Shape shape, IntDataBuffer data)
Create a TInt32 constant with data from the given buffer.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- an integer constant
Throws
| IllegalArgumentException | If the tensor shape is not compatible with the buffer |
|---|
public static Constant<TInt64> tensorOf (Scope scope, long[][] data)
Creates a rank-2 constant of long elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a long constant
public static Constant<TInt64> tensorOf (Scope scope, Shape shape, LongDataBuffer data)
Create a TInt64 constant with data from the given buffer.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- a long constant
Throws
| IllegalArgumentException | If the tensor shape is not compatible with the buffer |
|---|
public static Constant<TFloat32> tensorOf (Scope scope, float[][][][] data)
Creates a rank-4 constant of float elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a float constant
public static Constant<TBool> tensorOf (Scope scope, boolean[][][] data)
Creates a rank-3 constant of boolean elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a boolean constant
public static Constant<TString> tensorOf (Scope scope, String[][][] data)
Creates a rank-3 constant of String elements, using default UTF-8 encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a
TStringconstant matrix
public static Constant<TInt64> tensorOf (Scope scope, long[][][][][][] data)
Creates a rank-6 constant of long elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a long constant
public static Constant<TInt64> tensorOf (Scope scope, long[][][][] data)
Creates a rank-4 constant of long elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a long constant
public static Constant<TInt32> tensorOf (Scope scope, int[][][] data)
Creates a rank-3 constant of int elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- an integer constant
public static Constant<TString> tensorOf (Scope scope, Shape shape, DataBuffer<String> data)
Create a TString constant with data from the given buffer, using the default UTF-8
encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- a string constant
Throws
| IllegalArgumentException | If the tensor shape is not compatible with the buffer |
|---|
public static Constant<TBool> tensorOf (Scope scope, boolean[][] data)
Creates a rank-2 constant of boolean elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a boolean constant
public static Constant<TInt32> tensorOf (Scope scope, int[][][][][] data)
Creates a rank-5 constant of int elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- an integer constant
public static Constant<TFloat64> tensorOf (Scope scope, DoubleNdArray data)
Creates a constant of double elements that is a copy of a given n-dimensional array.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | an n-dimensional array of double elements. |
Returns
- a double constant
public static Constant<TString> tensorOf (Scope scope, Charset charset, NdArray<String> data)
Creates a constant of String elements that is a copy of a given n-dimensional array,
using the given encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| charset | charset used to encode/decode string bytes. |
| data | an n-dimensional array of String elements. |
Returns
- a string constant
public static Constant<T> tensorOf (Scope scope, Class<T> type, Shape shape, ByteDataBuffer data)
Create a constant with data from the given buffer.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| type | the tensor type class |
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- a constant of type `type`
Throws
| IllegalArgumentException | If the tensor datatype or shape is not compatible with the buffer |
|---|
public static Constant<TString> tensorOf (Scope scope, Charset charset, Shape shape, DataBuffer<String> data)
Create a TString constant with data from the given buffer, using the given encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| charset | charset used to encode/decode string bytes. |
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- a string constant
Throws
| IllegalArgumentException | If the tensor shape is not compatible with the buffer |
|---|
public static Constant<TFloat64> tensorOf (Scope scope, double[][][][][][] data)
Creates a rank-6 constant of double elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a double constant
public static Constant<TFloat32> tensorOf (Scope scope, FloatNdArray data)
Creates a constant of float elements that is a copy of a given n-dimensional array.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | an n-dimensional array of float elements. |
Returns
- a float constant
public static Constant<TBool> tensorOf (Scope scope, boolean[][][][][] data)
Creates a rank-5 constant of boolean elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a boolean constant
public static Constant<T> tensorOf (Scope scope, Class<T> type, Number number)
Creates a scalar of type, with the value of number. number may be truncated if it does not
fit in the target type.
Parameters
| type | the type of tensor to create. Must be concrete (i.e. not TFloating) |
|---|---|
| number | the value of the tensor |
Returns
- a constant of the passed type
Throws
| IllegalArgumentException | if the type is abstract (i.e. TFloating) or
unknown.
|
|---|
public static Constant<TUint8> tensorOf (Scope scope, ByteNdArray data)
Creates a constant of byte elements that is a copy of a given n-dimensional array.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | an n-dimensional array of byte elements. |
Returns
- a byte constant
public static Constant<TBool> tensorOf (Scope scope, Shape shape, BooleanDataBuffer data)
Create a TBool constant with data from the given buffer.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- an boolean constant
Throws
| IllegalArgumentException | If the tensor shape is not compatible with the buffer |
|---|
public static Constant<TFloat32> tensorOf (Scope scope, float[][] data)
Creates a rank-2 constant of float elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a float constant
public static Constant<TUint8> tensorOf (Scope scope, byte[][] data)
Creates a rank-2 constant of byte elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a byte constant
public static Constant<TFloat32> tensorOf (Scope scope, Shape shape, FloatDataBuffer data)
Create a TFloat32 constant with data from the given buffer.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- a float constant
Throws
| IllegalArgumentException | If the tensor shape is not compatible with the buffer |
|---|
public static Constant<TBool> tensorOf (Scope scope, BooleanNdArray data)
Creates a constant of boolean elements that is a copy of a given n-dimensional array.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | an n-dimensional array of boolean elements. |
Returns
- a boolean constant
public static Constant<TInt64> tensorOf (Scope scope, Shape shape)
Creates a rank-1 constant of long elements representing the size of each dimensions of
the given shape.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| shape | a shape |
Returns
- a long constant
public static Constant<TFloat32> tensorOf (Scope scope, float[][][][][] data)
Creates a rank-5 constant of float elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a float constant
public static Constant<TUint8> tensorOf (Scope scope, Shape shape, ByteDataBuffer data)
Create a TUint8 constant with data from the given buffer.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- a byte constant
Throws
| IllegalArgumentException | If the tensor shape is not compatible with the buffer |
|---|
public static Constant<TString> tensorOf (Scope scope, NdArray<String> data)
Creates a constant of String elements that is a copy of a given n-dimensional array,
using the default UTF-8 encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | an n-dimensional array of String elements. |
Returns
- a string constant
public static Constant<TUint8> tensorOf (Scope scope, byte[][][] data)
Creates a rank-3 constant of byte elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a byte constant
public static Constant<TFloat64> tensorOf (Scope scope, double[][] data)
Creates a rank-2 constant of double elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a double constant
public static Constant<TString> tensorOf (Scope scope, String[][] data)
Creates a rank-2 constant of String elements, using default UTF-8 encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a
TStringconstant matrix
public static Constant<TFloat64> tensorOf (Scope scope, Shape shape, DoubleDataBuffer data)
Create a TFloat64 constant with data from the given buffer.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| shape | the tensor shape. |
| data | a buffer containing the tensor data. |
Returns
- a double constant
Throws
| IllegalArgumentException | If the tensor shape is not compatible with the buffer |
|---|
public static Constant<TInt64> tensorOf (Scope scope, long[][][][][] data)
Creates a rank-5 constant of long elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a long constant
public static Constant<TBool> tensorOf (Scope scope, boolean[][][][] data)
Creates a rank-4 constant of boolean elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a boolean constant
public static Constant<TFloat32> tensorOf (Scope scope, float[][][] data)
Creates a rank-3 constant of float elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a float constant
public static Constant<TUint8> tensorOf (Scope scope, byte[][][][][] data)
Creates a rank-5 constant of byte elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a byte constant
public static Constant<TString> tensorOf (Scope scope, String[][][][][] data)
Creates a rank-5 constant of String elements, using default UTF-8 encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a
TStringconstant matrix
public static Constant<TInt64> tensorOf (Scope scope, long[][][] data)
Creates a rank-3 constant of long elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a long constant
public static Constant<TUint8> tensorOf (Scope scope, byte[][][][][][] data)
Creates a rank-6 constant of byte elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a byte constant
public static Constant<TFloat32> tensorOf (Scope scope, float[][][][][][] data)
Creates a rank-6 constant of float elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a float constant
public static Constant<TInt32> tensorOf (Scope scope, int[][][][][][] data)
Creates a rank-6 constant of int elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- an integer constant
public static Constant<TInt32> tensorOf (Scope scope, IntNdArray data)
Creates a constant of int elements that is a copy of a given n-dimensional array.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | an n-dimensional array of int elements. |
Returns
- an integer constant
public static Constant<TInt32> tensorOf (Scope scope, int[][][][] data)
Creates a rank-4 constant of int elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- an integer constant
public static Constant<TFloat64> tensorOf (Scope scope, double[][][][][] data)
Creates a rank-5 constant of double elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a double constant
public static Constant<TInt64> tensorOf (Scope scope, LongNdArray data)
Creates a constant of long elements that is a copy of a given n-dimensional array.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | an n-dimensional array of long elements. |
Returns
- a long constant
public static Constant<TString> tensorOf (Scope scope, String[][][][] data)
Creates a rank-4 constant of String elements, using default UTF-8 encoding.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. |
Returns
- a
TStringconstant matrix
public static Constant<TFloat64> tensorOf (Scope scope, double[][][][] data)
Creates a rank-4 constant of double elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a double constant
public static Constant<T> tensorOfSameType (Scope scope, Operand<T> toMatch, Number number)
Creates a scalar of the same type as toMatch, with the value of number. number may be
truncated if it does not fit in the target type.
Parameters
| toMatch | the operand providing the target type |
|---|---|
| number | the value of the tensor |
Returns
- a constant with the same type as
toMatch
Throws
| IllegalArgumentException | if the type is unknown (which should be impossible). |
|---|
See Also
public static Constant<TUint8> vectorOf (Scope scope, byte[] data)
Creates a rank-1 constant of byte elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a byte constant
public static Constant<TInt64> vectorOf (Scope scope, long[] data)
Creates a rank-1 constant of long elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a long constant
public static Constant<TFloat64> vectorOf (Scope scope, double[] data)
Creates a rank-1 constant of double elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a double constant
public static Constant<TInt32> vectorOf (Scope scope, int[] data)
Creates a rank-1 constant of int elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- an integer constant
public static Constant<TString> vectorOf (Scope scope, Charset charset, String[] data)
Creates a constant of String elements, using the given charset.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| charset | charset for encoding/decoding strings bytes. |
| data | An array containing the values to put into the new constant. String elements are sequences of bytes from the last array dimension. |
Returns
- the
Stringconstant
public static Constant<TFloat32> vectorOf (Scope scope, float[] data)
Creates a rank-1 constant of float elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a float constant
public static Constant<TBool> vectorOf (Scope scope, boolean[] data)
Creates a rank-1 constant of boolean elements.
Parameters
| scope | is a scope used to add the underlying operation. |
|---|---|
| data | An array containing the values to put into the new constant. The dimensions of the new constant will match those of the array. |
Returns
- a boolean constant