public class DenseTensorBuilder extends java.lang.Object implements TensorBuilder, BulkTensorBuilder
Primitive.INT representation.
The last column type is considered to be value type and determines| Constructor and Description |
|---|
DenseTensorBuilder(Representable[] columnTypes,
long[] shape) |
DenseTensorBuilder(TensorType tensorType) |
| Modifier and Type | Method and Description |
|---|---|
TensorBuilder |
append()
Tells this TensorBuilder that the current row is complete.
|
TensorData |
build(boolean sort)
Build the tensor
|
TensorData |
build(boolean[] booleans) |
TensorData |
build(java.nio.ByteBuffer values) |
TensorData |
build(double[] doubles) |
TensorData |
build(float[] floats) |
TensorData |
build(int[] ints) |
TensorData |
build(java.util.List<?> values) |
TensorData |
build(long[] longs) |
Representable[] |
getOutputTypes() |
int |
getStaticCardinality()
The full count of the tensor values, ignoring a possible unknown dimension.
|
Representable[] |
getTypes() |
boolean |
hasVariableCardinality()
If the actual cardinality can be a multiple of the static cardinality, as opposed to exactly equal.
|
TensorBuilder |
setBoolean(int column,
boolean value)
Sets the specified column to a given `boolean`
|
TensorBuilder |
setBytes(int column,
byte[] value)
Sets the specified column to a given `byte array`
|
TensorBuilder |
setDouble(int column,
double value)
Sets the specified column to a given `double`
|
TensorBuilder |
setFloat(int column,
float value)
Sets the specified column to a given `float`
|
TensorBuilder |
setInt(int column,
int value)
DenseTensorBuilder's setInt should be used seldomly.
|
TensorBuilder |
setLong(int column,
long value)
Sets the specified column to a given `long`
|
TensorBuilder |
setString(int column,
java.lang.String value)
Sets the specified column to a given `String`
|
TensorBuilder |
start(int estimatedRows)
Initializes this TensorBuilder.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuild, copyColumn, copyColumns, copyColumns, copyColumns, copyLeftColumns, startsetValuepublic DenseTensorBuilder(Representable[] columnTypes, long[] shape)
public DenseTensorBuilder(TensorType tensorType)
public int getStaticCardinality()
BulkTensorBuildergetStaticCardinality in interface BulkTensorBuilderpublic boolean hasVariableCardinality()
BulkTensorBuilderhasVariableCardinality in interface BulkTensorBuilderpublic TensorBuilder append()
TensorBuilderWriteableTuple.setInt(int, int), WriteableTuple.setFloat(int, float), etc. to set all the columns of the current row.append in interface TensorBuilderpublic TensorBuilder start(int estimatedRows)
TensorBuilderTensorBuilder.start() MUST be called before setting values
to this TensorBuilder. This method may also be used to "reset" the builder, enabling it to be reused.start in interface TensorBuilderestimatedRows - The estimated number of rows in this tensor. Implementations can use this to allocate internal
array sizes, for example.public Representable[] getOutputTypes()
getOutputTypes in interface TypedOperatorpublic Representable[] getTypes()
getTypes in interface WriteableTuplepublic TensorBuilder setInt(int column, int value)
setInt in interface WriteableTuplecolumn - The column in the tuple to write tovalue - The int value to be writtenpublic TensorBuilder setLong(int column, long value)
WriteableTuplesetLong in interface WriteableTuplecolumn - The column in the tuple to write tovalue - The long value to be writtenpublic TensorBuilder setFloat(int column, float value)
WriteableTuplesetFloat in interface WriteableTuplecolumn - The column in the tuple to write tovalue - The float value to be writtenpublic TensorBuilder setDouble(int column, double value)
WriteableTuplesetDouble in interface WriteableTuplesetDouble in interface TensorBuildercolumn - The column in the tuple to write tovalue - The double value to be writtenpublic TensorBuilder setBoolean(int column, boolean value)
WriteableTuplesetBoolean in interface WriteableTuplesetBoolean in interface TensorBuildercolumn - The column in the tuple to write tovalue - The double value to be writtenpublic TensorBuilder setString(int column, java.lang.String value)
WriteableTuplesetString in interface WriteableTuplesetString in interface TensorBuildercolumn - The column in the tuple to write tovalue - The String value to be writtenpublic TensorBuilder setBytes(int column, byte[] value)
WriteableTuplesetBytes in interface WriteableTuplecolumn - The column in the tuple to write tovalue - The byte array value to be writtenpublic TensorData build(float[] floats)
build in interface BulkTensorBuilderpublic TensorData build(int[] ints)
build in interface BulkTensorBuilderpublic TensorData build(long[] longs)
build in interface BulkTensorBuilderpublic TensorData build(double[] doubles)
build in interface BulkTensorBuilderpublic TensorData build(boolean[] booleans)
build in interface BulkTensorBuilderpublic TensorData build(java.util.List<?> values)
build in interface BulkTensorBuilderpublic TensorData build(java.nio.ByteBuffer values)
build in interface BulkTensorBuilderpublic TensorData build(boolean sort)
TensorBuilderbuild in interface TensorBuildersort - if set to true, the built tensor's rows will be sorted lexicographically