trait TensorBuilder[T <: TensorBuilder[T]] extends TypedOperator with WriteableTuple[T]
A stateful object used to build instances of tensors of some specific representation without knowing its details.
Values are written to the builder row-wise.
How to use:
- Initialize the builder using
#start2. Set values for each column in the first row, using#setInt,#setFloat, etc. 3. Call#appendto finish the row. 4. Repeat steps 2 and 3 for any remaining rows. 5. Call#buildto build the TensorData object.
Instances of TensorBuilder can be safely reused by calling #start to "reset" the builder.
Except for any subclass implementation that explicitly states otherwise, instances of TensorBuilder MUST NOT be used in a concurrent fashion.
- Alphabetic
- By Inheritance
- TensorBuilder
- WriteableTuple
- TypedOperator
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
append(): T
Tells this TensorBuilder that the current row is complete.
-
abstract
def
build(sort: Boolean): TensorData
Build the tensor
Build the tensor
- sort
if set to true, the built tensor's rows will be sorted lexicographically
- returns
the built tensor
-
abstract
def
getOutputTypes(): Array[Representable]
- Definition Classes
- TypedOperator
-
abstract
def
getTypes(): Array[Representable]
- returns
the types of all dimensions and the value as a single array.
- Definition Classes
- WriteableTuple
-
abstract
def
setFloat(column: Int, value: Float): T
Sets the specified column to a given
floatSets the specified column to a given
float- column
The column in the tuple to write to
- value
The float value to be written
- returns
A reference to this object (
this)
- Definition Classes
- WriteableTuple
-
abstract
def
setInt(column: Int, value: Int): T
Sets the specified column to a given
intSets the specified column to a given
int- column
The column in the tuple to write to
- value
The int value to be written
- returns
A reference to this object (
this)
- Definition Classes
- WriteableTuple
-
abstract
def
setLong(column: Int, value: Long): T
Sets the specified column to a given
longSets the specified column to a given
long- column
The column in the tuple to write to
- value
The long value to be written
- returns
A reference to this object (
this)
- Definition Classes
- WriteableTuple
-
abstract
def
start(estimatedRows: Int): T
Initializes this TensorBuilder.
Initializes this TensorBuilder. This method (or overloaded
#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.- estimatedRows
The estimated number of rows in this tensor. Implementations can use this to allocate internal array sizes, for example.
- returns
a reference to this TensorBuilder (
this)
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
build(): TensorData
Build the tensor Does NOT reset the internal state, so if you plan to reuse this instance, call
#start()or#start(int)before reusing.Build the tensor Does NOT reset the internal state, so if you plan to reuse this instance, call
#start()or#start(int)before reusing.- returns
the final built tensor, forcing lexicographical sorting.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
copyColumn(source: TensorIterator, sourceColumn: Int, destinationColumn: Int): T
Copy a single column from source to this builder.
Copy a single column from source to this builder.
- source
the source from which to copy
- sourceColumn
the index number of the column to be copied from the source
- destinationColumn
the index number of the column to be written to in this TensorBuilder
- returns
a reference to this TensorBuilder (
this)
- def copyColumns(left: TensorIterator, right: TensorIterator, sourceColumns: Array[Int], leftArity: Int): T
- def copyColumns(left: TensorIterator, right: TensorIterator, sourceColumns: Array[Int]): T
-
def
copyColumns(source: TensorIterator, sourceColumns: Array[Int]): T
Copy multiple columns from source to this builder.
Copy multiple columns from source to this builder.
- source
the source from which to copy
- sourceColumns
array of indices of the columns to be copied from the source and written to this TensorBuilder. Note that the columns are copied from the source into the same position in this builder; values read from column
iare written to columni, etc.- returns
a reference to this TensorBuilder (
this)
-
def
copyLeftColumns(source: TensorIterator, count: Int): T
Copy some left-most columns from source to this builder (slightly more efficient than using an array of columns).
Copy some left-most columns from source to this builder (slightly more efficient than using an array of columns).
- source
the source from which to copy
- count
the number of columns to copy, starting from the leftmost column (index 0)
- returns
a reference to this TensorBuilder (
this)
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
setBoolean(index: Int, value: Boolean): T
Sets the specified column to a given
booleanSets the specified column to a given
boolean- value
The double value to be written
- returns
A reference to this object (
this)
- Definition Classes
- TensorBuilder → WriteableTuple
- Annotations
- @Override()
-
def
setBytes(column: Int, value: Array[Byte]): T
Sets the specified column to a given
byte arraySets the specified column to a given
byte array- column
The column in the tuple to write to
- value
The byte array value to be written
- returns
A reference to this object (
this)
- Definition Classes
- WriteableTuple
-
def
setDouble(index: Int, value: Double): T
Sets the specified column to a given
doubleSets the specified column to a given
double- value
The double value to be written
- returns
A reference to this object (
this)
- Definition Classes
- TensorBuilder → WriteableTuple
- Annotations
- @Override()
-
def
setString(index: Int, value: String): T
Sets the specified column to a given
StringSets the specified column to a given
String- value
The String value to be written
- returns
A reference to this object (
this)
- Definition Classes
- TensorBuilder → WriteableTuple
- Annotations
- @Override()
-
def
setValue(index: Int, value: Any): T
- Definition Classes
- WriteableTuple
-
def
start(): T
Initializes this TensorBuilder.
Initializes this TensorBuilder. This method (or overloaded
#start(int)MUST be called before setting values to this TensorBuilder. This method may also be used to "reset" the builder, enabling it to be reused.- returns
a reference to this TensorBuilder (
this)
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()