@Operator public final class Constant<T extends TType> extends RawOp implements Operand<T>
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...)
Modifier and Type | Method and Description |
---|---|
static Constant<TBool> |
arrayOf(Scope scope,
boolean... data)
Creates a constant of
boolean elements. |
static Constant<TUint8> |
arrayOf(Scope scope,
byte... data)
Creates a constant of
byte elements. |
static Constant<TString> |
arrayOf(Scope scope,
Charset charset,
String... data)
Creates a constant of
String elements, using the given charset. |
static Constant<TFloat64> |
arrayOf(Scope scope,
double... data)
Creates a constant of
double elements. |
static Constant<TFloat32> |
arrayOf(Scope scope,
float... data)
Creates a constant of
float elements. |
static Constant<TInt32> |
arrayOf(Scope scope,
int... data)
Creates a constant of
int elements. |
static Constant<TInt64> |
arrayOf(Scope scope,
long... data)
Creates a constant of
long elements. |
static Constant<TString> |
arrayOf(Scope scope,
String... data)
Creates a constant of
String elements, using the default UTF-8 charset. |
Output<T> |
asOutput()
Returns the symbolic handle of the tensor.
|
static <T extends TType> |
create(Scope scope,
T tensor)
Create a constant by making an immutable copy of
tensor . |
static Constant<TBool> |
scalarOf(Scope scope,
boolean data)
Creates a constant containing a single
boolean element. |
static Constant<TUint8> |
scalarOf(Scope scope,
byte data)
Creates a constant containing a single
byte element. |
static Constant<TString> |
scalarOf(Scope scope,
Charset charset,
String data)
Creates a
String constant using a specified encoding. |
static Constant<TFloat64> |
scalarOf(Scope scope,
double data)
Creates a constant containing a single
double element. |
static Constant<TFloat32> |
scalarOf(Scope scope,
float data)
Creates a constant containing a single
float element. |
static Constant<TInt32> |
scalarOf(Scope scope,
int data)
Creates a constant containing a single
int element. |
static Constant<TInt64> |
scalarOf(Scope scope,
long data)
Creates a constant containing a single
long element. |
static Constant<TString> |
scalarOf(Scope scope,
String data)
Creates a
String constant using the default, UTF-8 encoding. |
static Constant<TBool> |
tensorOf(Scope scope,
boolean[][] data)
Creates a rank-2 constant of
boolean elements. |
static Constant<TBool> |
tensorOf(Scope scope,
boolean[][][] data)
Creates a rank-3 constant of
boolean elements. |
static Constant<TBool> |
tensorOf(Scope scope,
boolean[][][][] data)
Creates a rank-4 constant of
boolean elements. |
static Constant<TBool> |
tensorOf(Scope scope,
boolean[][][][][] data)
Creates a rank-5 constant of
boolean elements. |
static Constant<TBool> |
tensorOf(Scope scope,
boolean[][][][][][] data)
Creates a rank-6 constant of
boolean elements. |
static Constant<TBool> |
tensorOf(Scope scope,
org.tensorflow.ndarray.BooleanNdArray data)
Creates a constant of
boolean elements that is a copy of a given n-dimensional array. |
static Constant<TUint8> |
tensorOf(Scope scope,
byte[][] data)
Creates a rank-2 constant of
byte elements. |
static Constant<TUint8> |
tensorOf(Scope scope,
byte[][][] data)
Creates a rank-3 constant of
byte elements. |
static Constant<TUint8> |
tensorOf(Scope scope,
byte[][][][] data)
Creates a rank-4 constant of
byte elements. |
static Constant<TUint8> |
tensorOf(Scope scope,
byte[][][][][] data)
Creates a rank-5 constant of
byte elements. |
static Constant<TUint8> |
tensorOf(Scope scope,
byte[][][][][][] data)
Creates a rank-6 constant of
byte elements. |
static Constant<TUint8> |
tensorOf(Scope scope,
org.tensorflow.ndarray.ByteNdArray data)
Creates a constant of
byte elements that is a copy of a given n-dimensional array. |
static Constant<TString> |
tensorOf(Scope scope,
Charset charset,
org.tensorflow.ndarray.NdArray<String> data)
Creates a constant of
String elements that is a copy of a given n-dimensional array,
using the given encoding. |
static Constant<TString> |
tensorOf(Scope scope,
Charset charset,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.DataBuffer<String> data)
Create a
TString constant with data from the given buffer, using the given encoding. |
static <T extends TNumber> |
tensorOf(Scope scope,
Class<T> type,
Number number)
Creates a scalar of
type , with the value of number . |
static <T extends TType> |
tensorOf(Scope scope,
Class<T> type,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.ByteDataBuffer data)
Create a constant with data from the given buffer.
|
static Constant<TFloat64> |
tensorOf(Scope scope,
double[][] data)
Creates a rank-2 constant of
double elements. |
static Constant<TFloat64> |
tensorOf(Scope scope,
double[][][] data)
Creates a rank-3 constant of
double elements. |
static Constant<TFloat64> |
tensorOf(Scope scope,
double[][][][] data)
Creates a rank-4 constant of
double elements. |
static Constant<TFloat64> |
tensorOf(Scope scope,
double[][][][][] data)
Creates a rank-5 constant of
double elements. |
static Constant<TFloat64> |
tensorOf(Scope scope,
double[][][][][][] data)
Creates a rank-6 constant of
double elements. |
static Constant<TFloat64> |
tensorOf(Scope scope,
org.tensorflow.ndarray.DoubleNdArray data)
Creates a constant of
double elements that is a copy of a given n-dimensional array. |
static Constant<TFloat32> |
tensorOf(Scope scope,
float[][] data)
Creates a rank-2 constant of
float elements. |
static Constant<TFloat32> |
tensorOf(Scope scope,
float[][][] data)
Creates a rank-3 constant of
float elements. |
static Constant<TFloat32> |
tensorOf(Scope scope,
float[][][][] data)
Creates a rank-4 constant of
float elements. |
static Constant<TFloat32> |
tensorOf(Scope scope,
float[][][][][] data)
Creates a rank-5 constant of
float elements. |
static Constant<TFloat32> |
tensorOf(Scope scope,
float[][][][][][] data)
Creates a rank-6 constant of
float elements. |
static Constant<TFloat32> |
tensorOf(Scope scope,
org.tensorflow.ndarray.FloatNdArray data)
Creates a constant of
float elements that is a copy of a given n-dimensional array. |
static Constant<TInt32> |
tensorOf(Scope scope,
int[][] data)
Creates a rank-2 constant of
int elements. |
static Constant<TInt32> |
tensorOf(Scope scope,
int[][][] data)
Creates a rank-3 constant of
int elements. |
static Constant<TInt32> |
tensorOf(Scope scope,
int[][][][] data)
Creates a rank-4 constant of
int elements. |
static Constant<TInt32> |
tensorOf(Scope scope,
int[][][][][] data)
Creates a rank-5 constant of
int elements. |
static Constant<TInt32> |
tensorOf(Scope scope,
int[][][][][][] data)
Creates a rank-6 constant of
int elements. |
static Constant<TInt32> |
tensorOf(Scope scope,
org.tensorflow.ndarray.IntNdArray data)
Creates a constant of
int elements that is a copy of a given n-dimensional array. |
static Constant<TInt64> |
tensorOf(Scope scope,
long[][] data)
Creates a rank-2 constant of
long elements. |
static Constant<TInt64> |
tensorOf(Scope scope,
long[][][] data)
Creates a rank-3 constant of
long elements. |
static Constant<TInt64> |
tensorOf(Scope scope,
long[][][][] data)
Creates a rank-4 constant of
long elements. |
static Constant<TInt64> |
tensorOf(Scope scope,
long[][][][][] data)
Creates a rank-5 constant of
long elements. |
static Constant<TInt64> |
tensorOf(Scope scope,
long[][][][][][] data)
Creates a rank-6 constant of
long elements. |
static Constant<TInt64> |
tensorOf(Scope scope,
org.tensorflow.ndarray.LongNdArray data)
Creates a constant of
long elements that is a copy of a given n-dimensional array. |
static Constant<TString> |
tensorOf(Scope scope,
org.tensorflow.ndarray.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. |
static Constant<TInt64> |
tensorOf(Scope scope,
org.tensorflow.ndarray.Shape shape)
Creates a rank-1 constant of
long elements representing the size of each dimensions of
the given shape. |
static Constant<TBool> |
tensorOf(Scope scope,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.BooleanDataBuffer data)
Create a
TBool constant with data from the given buffer. |
static Constant<TUint8> |
tensorOf(Scope scope,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.ByteDataBuffer data)
Create a
TUint8 constant with data from the given buffer. |
static Constant<TString> |
tensorOf(Scope scope,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.DataBuffer<String> data)
Create a
TString constant with data from the given buffer, using the default UTF-8
encoding. |
static Constant<TFloat64> |
tensorOf(Scope scope,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.DoubleDataBuffer data)
Create a
TFloat64 constant with data from the given buffer. |
static Constant<TFloat32> |
tensorOf(Scope scope,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.FloatDataBuffer data)
Create a
TFloat32 constant with data from the given buffer. |
static Constant<TInt32> |
tensorOf(Scope scope,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.IntDataBuffer data)
Create a
TInt32 constant with data from the given buffer. |
static Constant<TInt64> |
tensorOf(Scope scope,
org.tensorflow.ndarray.Shape shape,
org.tensorflow.ndarray.buffer.LongDataBuffer data)
Create a
TInt64 constant with data from the given buffer. |
static Constant<TString> |
tensorOf(Scope scope,
String[][] data)
Creates a rank-2 constant of
String elements, using default UTF-8 encoding. |
static Constant<TString> |
tensorOf(Scope scope,
String[][][] data)
Creates a rank-3 constant of
String elements, using default UTF-8 encoding. |
static Constant<TString> |
tensorOf(Scope scope,
String[][][][] data)
Creates a rank-4 constant of
String elements, using default UTF-8 encoding. |
static Constant<TString> |
tensorOf(Scope scope,
String[][][][][] data)
Creates a rank-5 constant of
String elements, using default UTF-8 encoding. |
static Constant<TString> |
tensorOf(Scope scope,
String[][][][][][] data)
Creates a rank-6 constant of
String elements, using default UTF-8 encoding. |
static <T extends TNumber> |
tensorOfSameType(Scope scope,
Operand<T> toMatch,
Number number)
Creates a scalar of the same type as
toMatch , with the value of number . |
static Constant<TBool> |
vectorOf(Scope scope,
boolean[] data)
Creates a rank-1 constant of
boolean elements. |
static Constant<TUint8> |
vectorOf(Scope scope,
byte[] data)
Creates a rank-1 constant of
byte elements. |
static Constant<TString> |
vectorOf(Scope scope,
Charset charset,
String[] data)
Creates a constant of
String elements, using the given charset. |
static Constant<TFloat64> |
vectorOf(Scope scope,
double[] data)
Creates a rank-1 constant of
double elements. |
static Constant<TFloat32> |
vectorOf(Scope scope,
float[] data)
Creates a rank-1 constant of
float elements. |
static Constant<TInt32> |
vectorOf(Scope scope,
int[] data)
Creates a rank-1 constant of
int elements. |
static Constant<TInt64> |
vectorOf(Scope scope,
long[] data)
Creates a rank-1 constant of
long elements. |
static Constant<TString> |
vectorOf(Scope scope,
String[] data)
Creates a rank-1 constant of
String elements. |
public static final String OP_NAME
@Endpoint public static Constant<TInt32> scalarOf(Scope scope, int data)
int
element.scope
- is a scope used to add the underlying operation.data
- The value to put into the new constant.@Endpoint public static Constant<TInt32> vectorOf(Scope scope, int[] data)
int
elements.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.@Endpoint(name="array") public static Constant<TInt32> arrayOf(Scope scope, int... data)
int
elements.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.@Endpoint public static Constant<TInt32> tensorOf(Scope scope, int[][] data)
int
elements.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.@Endpoint public static Constant<TInt32> tensorOf(Scope scope, int[][][] data)
int
elements.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.@Endpoint public static Constant<TInt32> tensorOf(Scope scope, int[][][][] data)
int
elements.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.@Endpoint public static Constant<TInt32> tensorOf(Scope scope, int[][][][][] data)
int
elements.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.@Endpoint public static Constant<TInt32> tensorOf(Scope scope, int[][][][][][] data)
int
elements.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.@Endpoint public static Constant<TInt32> tensorOf(Scope scope, org.tensorflow.ndarray.IntNdArray data)
int
elements that is a copy of a given n-dimensional array.scope
- is a scope used to add the underlying operation.data
- an n-dimensional array of int
elements.@Endpoint public static Constant<TInt32> tensorOf(Scope scope, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.IntDataBuffer data)
TInt32
constant with data from the given buffer.scope
- is a scope used to add the underlying operation.shape
- the tensor shape.data
- a buffer containing the tensor data.IllegalArgumentException
- If the tensor shape is not compatible with the buffer@Endpoint public static Constant<TFloat32> scalarOf(Scope scope, float data)
float
element.scope
- is a scope used to add the underlying operation.data
- The value to put into the new constant.@Endpoint public static Constant<TFloat32> vectorOf(Scope scope, float[] data)
float
elements.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.@Endpoint(name="array") public static Constant<TFloat32> arrayOf(Scope scope, float... data)
float
elements.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.@Endpoint public static Constant<TFloat32> tensorOf(Scope scope, float[][] data)
float
elements.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.@Endpoint public static Constant<TFloat32> tensorOf(Scope scope, float[][][] data)
float
elements.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.@Endpoint public static Constant<TFloat32> tensorOf(Scope scope, float[][][][] data)
float
elements.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.@Endpoint public static Constant<TFloat32> tensorOf(Scope scope, float[][][][][] data)
float
elements.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.@Endpoint public static Constant<TFloat32> tensorOf(Scope scope, float[][][][][][] data)
float
elements.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.@Endpoint public static Constant<TFloat32> tensorOf(Scope scope, org.tensorflow.ndarray.FloatNdArray data)
float
elements that is a copy of a given n-dimensional array.scope
- is a scope used to add the underlying operation.data
- an n-dimensional array of float
elements.@Endpoint public static Constant<TFloat32> tensorOf(Scope scope, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.FloatDataBuffer data)
TFloat32
constant with data from the given buffer.scope
- is a scope used to add the underlying operation.shape
- the tensor shape.data
- a buffer containing the tensor data.IllegalArgumentException
- If the tensor shape is not compatible with the buffer@Endpoint public static Constant<TFloat64> scalarOf(Scope scope, double data)
double
element.scope
- is a scope used to add the underlying operation.data
- The value to put into the new constant.@Endpoint public static Constant<TFloat64> vectorOf(Scope scope, double[] data)
double
elements.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.@Endpoint(name="array") public static Constant<TFloat64> arrayOf(Scope scope, double... data)
double
elements.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.@Endpoint public static Constant<TFloat64> tensorOf(Scope scope, double[][] data)
double
elements.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.@Endpoint public static Constant<TFloat64> tensorOf(Scope scope, double[][][] data)
double
elements.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.@Endpoint public static Constant<TFloat64> tensorOf(Scope scope, double[][][][] data)
double
elements.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.@Endpoint public static Constant<TFloat64> tensorOf(Scope scope, double[][][][][] data)
double
elements.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.@Endpoint public static Constant<TFloat64> tensorOf(Scope scope, double[][][][][][] data)
double
elements.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.@Endpoint public static Constant<TFloat64> tensorOf(Scope scope, org.tensorflow.ndarray.DoubleNdArray data)
double
elements that is a copy of a given n-dimensional array.scope
- is a scope used to add the underlying operation.data
- an n-dimensional array of double
elements.@Endpoint public static Constant<TFloat64> tensorOf(Scope scope, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.DoubleDataBuffer data)
TFloat64
constant with data from the given buffer.scope
- is a scope used to add the underlying operation.shape
- the tensor shape.data
- a buffer containing the tensor data.IllegalArgumentException
- If the tensor shape is not compatible with the buffer@Endpoint public static Constant<TInt64> scalarOf(Scope scope, long data)
long
element.scope
- is a scope used to add the underlying operation.data
- The value to put into the new constant.@Endpoint public static Constant<TInt64> vectorOf(Scope scope, long[] data)
long
elements.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.@Endpoint public static Constant<TInt64> tensorOf(Scope scope, long[][] data)
long
elements.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.@Endpoint(name="array") public static Constant<TInt64> arrayOf(Scope scope, long... data)
long
elements.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.@Endpoint public static Constant<TInt64> tensorOf(Scope scope, long[][][] data)
long
elements.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.@Endpoint public static Constant<TInt64> tensorOf(Scope scope, long[][][][] data)
long
elements.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.@Endpoint public static Constant<TInt64> tensorOf(Scope scope, long[][][][][] data)
long
elements.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.@Endpoint public static Constant<TInt64> tensorOf(Scope scope, long[][][][][][] data)
long
elements.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.@Endpoint public static Constant<TInt64> tensorOf(Scope scope, org.tensorflow.ndarray.LongNdArray data)
long
elements that is a copy of a given n-dimensional array.scope
- is a scope used to add the underlying operation.data
- an n-dimensional array of long
elements.@Endpoint public static Constant<TInt64> tensorOf(Scope scope, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.LongDataBuffer data)
TInt64
constant with data from the given buffer.scope
- is a scope used to add the underlying operation.shape
- the tensor shape.data
- a buffer containing the tensor data.IllegalArgumentException
- If the tensor shape is not compatible with the buffer@Endpoint public static Constant<TBool> scalarOf(Scope scope, boolean data)
boolean
element.scope
- is a scope used to add the underlying operation.data
- The value to put into the new constant.@Endpoint public static Constant<TBool> vectorOf(Scope scope, boolean[] data)
boolean
elements.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.@Endpoint(name="array") public static Constant<TBool> arrayOf(Scope scope, boolean... data)
boolean
elements.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.@Endpoint public static Constant<TBool> tensorOf(Scope scope, boolean[][] data)
boolean
elements.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.@Endpoint public static Constant<TBool> tensorOf(Scope scope, boolean[][][] data)
boolean
elements.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.@Endpoint public static Constant<TBool> tensorOf(Scope scope, boolean[][][][] data)
boolean
elements.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.@Endpoint public static Constant<TBool> tensorOf(Scope scope, boolean[][][][][] data)
boolean
elements.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.@Endpoint public static Constant<TBool> tensorOf(Scope scope, boolean[][][][][][] data)
boolean
elements.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.@Endpoint public static Constant<TBool> tensorOf(Scope scope, org.tensorflow.ndarray.BooleanNdArray data)
boolean
elements that is a copy of a given n-dimensional array.scope
- is a scope used to add the underlying operation.data
- an n-dimensional array of boolean
elements.@Endpoint public static Constant<TBool> tensorOf(Scope scope, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.BooleanDataBuffer data)
TBool
constant with data from the given buffer.scope
- is a scope used to add the underlying operation.shape
- the tensor shape.data
- a buffer containing the tensor data.IllegalArgumentException
- If the tensor shape is not compatible with the buffer@Endpoint public static Constant<TUint8> scalarOf(Scope scope, byte data)
byte
element.scope
- is a scope used to add the underlying operation.data
- The value to put into the new constant.@Endpoint public static Constant<TUint8> vectorOf(Scope scope, byte[] data)
byte
elements.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.@Endpoint(name="array") public static Constant<TUint8> arrayOf(Scope scope, byte... data)
byte
elements.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.@Endpoint public static Constant<TUint8> tensorOf(Scope scope, byte[][] data)
byte
elements.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.@Endpoint public static Constant<TUint8> tensorOf(Scope scope, byte[][][] data)
byte
elements.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.@Endpoint public static Constant<TUint8> tensorOf(Scope scope, byte[][][][] data)
byte
elements.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.@Endpoint public static Constant<TUint8> tensorOf(Scope scope, byte[][][][][] data)
byte
elements.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.@Endpoint public static Constant<TUint8> tensorOf(Scope scope, byte[][][][][][] data)
byte
elements.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.@Endpoint public static Constant<TUint8> tensorOf(Scope scope, org.tensorflow.ndarray.ByteNdArray data)
byte
elements that is a copy of a given n-dimensional array.scope
- is a scope used to add the underlying operation.data
- an n-dimensional array of byte
elements.@Endpoint public static Constant<TUint8> tensorOf(Scope scope, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.ByteDataBuffer data)
TUint8
constant with data from the given buffer.scope
- is a scope used to add the underlying operation.shape
- the tensor shape.data
- a buffer containing the tensor data.IllegalArgumentException
- If the tensor shape is not compatible with the buffer@Endpoint public static <T extends TType> Constant<T> tensorOf(Scope scope, Class<T> type, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.ByteDataBuffer data)
T
- the tensor typescope
- is a scope used to add the underlying operation.type
- the tensor type classshape
- the tensor shape.data
- a buffer containing the tensor data.IllegalArgumentException
- If the tensor datatype or shape is not compatible with the
buffer@Endpoint public static Constant<TString> scalarOf(Scope scope, String data)
String
constant using the default, UTF-8 encoding.scope
- is a scope used to add the underlying operation.data
- The string to put into the new constant.@Endpoint public static Constant<TString> scalarOf(Scope scope, Charset charset, String data)
String
constant using a specified encoding.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.public static Constant<TString> vectorOf(Scope scope, String[] data)
String
elements.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.TString
constant matrix@Endpoint public static Constant<TString> vectorOf(Scope scope, Charset charset, String[] data)
String
elements, using the given charset.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.String
constant@Endpoint(name="array") public static Constant<TString> arrayOf(Scope scope, String... data)
String
elements, using the default UTF-8 charset.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.String
constant@Endpoint(name="array") public static Constant<TString> arrayOf(Scope scope, Charset charset, String... data)
String
elements, using the given charset.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.String
constantpublic static Constant<TString> tensorOf(Scope scope, String[][] data)
String
elements, using default UTF-8 encoding.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.TString
constant matrixpublic static Constant<TString> tensorOf(Scope scope, String[][][] data)
String
elements, using default UTF-8 encoding.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.TString
constant matrixpublic static Constant<TString> tensorOf(Scope scope, String[][][][] data)
String
elements, using default UTF-8 encoding.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.TString
constant matrixpublic static Constant<TString> tensorOf(Scope scope, String[][][][][] data)
String
elements, using default UTF-8 encoding.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.TString
constant matrixpublic static Constant<TString> tensorOf(Scope scope, String[][][][][][] data)
String
elements, using default UTF-8 encoding.scope
- is a scope used to add the underlying operation.data
- An array containing the values to put into the new constant.TString
constant matrix@Endpoint public static Constant<TString> tensorOf(Scope scope, org.tensorflow.ndarray.NdArray<String> data)
String
elements that is a copy of a given n-dimensional array,
using the default UTF-8 encoding.scope
- is a scope used to add the underlying operation.data
- an n-dimensional array of String
elements.@Endpoint public static Constant<TString> tensorOf(Scope scope, Charset charset, org.tensorflow.ndarray.NdArray<String> data)
String
elements that is a copy of a given n-dimensional array,
using the given encoding.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.@Endpoint public static Constant<TString> tensorOf(Scope scope, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.DataBuffer<String> data)
TString
constant with data from the given buffer, using the default UTF-8
encoding.scope
- is a scope used to add the underlying operation.shape
- the tensor shape.data
- a buffer containing the tensor data.IllegalArgumentException
- If the tensor shape is not compatible with the buffer@Endpoint public static Constant<TString> tensorOf(Scope scope, Charset charset, org.tensorflow.ndarray.Shape shape, org.tensorflow.ndarray.buffer.DataBuffer<String> data)
TString
constant with data from the given buffer, using the given encoding.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.IllegalArgumentException
- If the tensor shape is not compatible with the buffer@Endpoint public static Constant<TInt64> tensorOf(Scope scope, org.tensorflow.ndarray.Shape shape)
long
elements representing the size of each dimensions of
the given shape.scope
- is a scope used to add the underlying operation.shape
- a shape@Endpoint public static <T extends TNumber> Constant<T> tensorOf(Scope scope, Class<T> type, Number number)
type
, with the value of number
. number
may be
truncated if it does not fit in the target type.type
- the type of tensor to create. Must be concrete (i.e. not TFloating
)number
- the value of the tensorIllegalArgumentException
- if the type is abstract (i.e. TFloating
) or unknown.@Endpoint(name="constantOfSameType") public static <T extends TNumber> Constant<T> tensorOfSameType(Scope scope, Operand<T> toMatch, Number number)
toMatch
, with the value of number
. number
may be truncated if it does not fit in the target type.toMatch
- the operand providing the target typenumber
- the value of the tensortoMatch
IllegalArgumentException
- if the type is unknown (which should be impossible).Ops.constant(Class, Number)
@Endpoint(name="constantOf") public static <T extends TType> Constant<T> create(Scope scope, T tensor)
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)
}.
scope
- is a scope used to add the underlying operation.tensor
- a Tensor holding the constant valuepublic Output<T> asOutput()
Operand
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.
asOutput
in interface Operand<T extends TType>
OperationBuilder.addInput(Output)
Copyright © 2015–2022. All rights reserved.