TBool

public interface TBool

Boolean tensor type.

If direct memory mapping is not available in the JVM, tensors of this type might require an explicit mapping between Java boolean values and byte buffers using the BOOL layout, which may impact I/O performances.

Public Methods

abstract static TBool
scalarOf(boolean value)
Allocates a new tensor for storing a single boolean value.
abstract static TBool
tensorOf(Shape shape, BooleanDataBuffer data)
Allocates a new tensor of the given shape, initialized with the provided data.
abstract static TBool
tensorOf(Shape shape)
Allocates a new tensor of the given shape.
abstract static TBool
tensorOf(NdArray<Boolean> src)
Allocates a new tensor which is a copy of a given array of booleans.
abstract static TBool
tensorOf(Shape shape, Consumer<TBool> dataInit)
Allocates a new tensor of the given shape and initialize its data.
abstract static TBool
vectorOf(boolean... values)
Allocates a new tensor for storing a vector of booleans.

Inherited Methods

org.tensorflow.ndarray.BooleanNdArray
abstract BooleanNdArray
copyTo(NdArray<Boolean> dst)
abstract NdArraySequence<BooleanNdArray>
elements(int dimensionIdx)
Returns a sequence of all elements at a given dimension.
abstract BooleanNdArray
get(long... coordinates)
Returns the N-dimensional element of this array at the given coordinates.
abstract boolean
getBoolean(long... coordinates)
Returns the boolean value of the scalar found at the given coordinates.
abstract Boolean
getObject(long... coordinates)
Returns the value of the scalar found at the given coordinates.
abstract BooleanNdArray
read(DataBuffer<Boolean> dst)
abstract BooleanNdArray
abstract NdArraySequence<BooleanNdArray>
scalars()
Returns a sequence of all scalars in this array.
abstract BooleanNdArray
set(NdArray<Boolean> src, long... coordinates)
abstract BooleanNdArray
setBoolean(boolean value, long... coordinates)
Assigns the boolean value of the scalar found at the given coordinates.
abstract BooleanNdArray
setObject(Boolean value, long... coordinates)
abstract BooleanNdArray
slice(Index... indices)
Creates a multi-dimensional view (or slice) of this array by mapping one or more dimensions to the given index selectors.
abstract BooleanNdArray
write(DataBuffer<Boolean> src)
abstract BooleanNdArray
org.tensorflow.types.family.TType
abstract void
close()
Release resources associated with the Tensor.
abstract DataType
dataType()
Returns the DataType of elements stored in the tensor.
abstract long
numBytes()
Returns the size, in bytes, of the tensor data.
abstract Class<? extends TType>
type()
Returns the type of this tensor as a registered subclass of TType
org.tensorflow.ndarray.NdArray
abstract NdArray<Boolean>
copyTo(NdArray<Boolean> dst)
Copy the content of this array to the destination array.
abstract NdArraySequence<? extends NdArray<T>>
elements(int dimensionIdx)
Returns a sequence of all elements at a given dimension.
abstract boolean
equals(Object obj)
Checks equality between n-dimensional arrays.
abstract NdArray<Boolean>
get(long... coordinates)
Returns the N-dimensional element of this array at the given coordinates.
abstract Boolean
getObject(long... coordinates)
Returns the value of the scalar found at the given coordinates.
abstract NdArray<Boolean>
read(DataBuffer<Boolean> dst)
Read the content of this N-dimensional array into the destination buffer.
abstract NdArraySequence<? extends NdArray<T>>
scalars()
Returns a sequence of all scalars in this array.
abstract NdArray<Boolean>
set(NdArray<Boolean> src, long... coordinates)
Assigns the value of the N-dimensional element found at the given coordinates.
abstract NdArray<Boolean>
setObject(Boolean value, long... coordinates)
Assigns the value of the scalar found at the given coordinates.
abstract NdArray<Boolean>
slice(Index... indices)
Creates a multi-dimensional view (or slice) of this array by mapping one or more dimensions to the given index selectors.
abstract NdArray<Boolean>
write(DataBuffer<Boolean> src)
Write the content of this N-dimensional array from the source buffer.
org.tensorflow.Tensor
abstract RawTensor
asRawTensor()
Returns a raw (untyped) representation of this tensor
abstract void
close()
Release resources associated with the Tensor.
abstract DataType
dataType()
Returns the DataType of elements stored in the tensor.
abstract long
numBytes()
Returns the size, in bytes, of the tensor data.
abstract static <T extends TType> T
of(Class<T> type, Shape shape, long size, Consumer<T> dataInitializer)
Allocates a tensor of a given datatype, shape and size.
abstract static <T extends TType> T
of(Class<T> type, Shape shape)
Allocates a tensor of a given datatype and shape.
abstract static <T extends TType> T
of(Class<T> type, Shape shape, long size)
Allocates a tensor of a given datatype, shape and size.
abstract static <T extends TType> T
of(Class<T> type, Shape shape, Consumer<T> dataInitializer)
Allocates and initialize a tensor of a given datatype and shape.
abstract static <T extends TType> T
of(Class<T> type, Shape shape, ByteDataBuffer rawData)
Creates a Tensor of any type from the raw data provided by the given buffer.
abstract Shape
shape()
Returns the shape of the tensor.
org.tensorflow.ndarray.Shaped
abstract int
rank()
abstract Shape
shape()
abstract long
size()
Computes and returns the total size of this container, in number of values.
abstract void
close()

Public Methods

public static abstract TBool scalarOf (boolean value)

Allocates a new tensor for storing a single boolean value.

Parameters
value boolean to store in the new tensor
Returns
  • the new tensor

public static abstract TBool tensorOf (Shape shape, BooleanDataBuffer data)

Allocates a new tensor of the given shape, initialized with the provided data.

Parameters
shape shape of the tensor to allocate
data buffer of booleans to initialize the tensor with
Returns
  • the new tensor

public static abstract TBool tensorOf (Shape shape)

Allocates a new tensor of the given shape.

Parameters
shape shape of the tensor to allocate
Returns
  • the new tensor

public static abstract TBool tensorOf (NdArray<Boolean> src)

Allocates a new tensor which is a copy of a given array of booleans.

The tensor will have the same shape as the source array and its data will be copied.

Parameters
src the source array giving the shape and data to the new tensor
Returns
  • the new tensor

public static abstract TBool tensorOf (Shape shape, Consumer<TBool> dataInit)

Allocates a new tensor of the given shape and initialize its data.

Parameters
shape shape of the tensor to allocate
dataInit tensor data initializer
Returns
  • the new tensor
Throws
TensorFlowException if the tensor cannot be allocated or initialized

public static abstract TBool vectorOf (boolean... values)

Allocates a new tensor for storing a vector of booleans.

Parameters
values booleans to store in the new tensor
Returns
  • the new tensor