Package org.tribuo.interop.tensorflow
Class TensorFlowUtil.TensorTuple
java.lang.Object
org.tribuo.interop.tensorflow.TensorFlowUtil.TensorTuple
- All Implemented Interfaces:
Serializable
- Enclosing class:
- TensorFlowUtil
A serializable tuple containing the tensor class name, the shape and the data.
It's almost a record.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTensorTuple
(String className, long[] shape, byte[] data) Makes a TensorTuple.TensorTuple
(org.tribuo.interop.tensorflow.protos.TensorTupleProto proto) Deserializes the tensor tuple from the supplied protobuf. -
Method Summary
Modifier and TypeMethodDescriptionstatic TensorFlowUtil.TensorTuple
of
(org.tensorflow.types.family.TType tensor) Makes a TensorTuple out of this tensor.org.tensorflow.Tensor
Recreates the Tensor from the serialized form.org.tribuo.interop.tensorflow.protos.TensorTupleProto
Serializes this object to a protobuf.
-
Field Details
-
className
The tensor class name. -
shape
public final long[] shapeThe shape of the tensor. -
data
public final byte[] dataThe tensor data.
-
-
Constructor Details
-
TensorTuple
Makes a TensorTuple.- Parameters:
className
- The tensor class name.shape
- The dimensions of the tensor.data
- The data in the tensor.
-
TensorTuple
public TensorTuple(org.tribuo.interop.tensorflow.protos.TensorTupleProto proto) Deserializes the tensor tuple from the supplied protobuf.- Parameters:
proto
- The proto to deserialize.
-
-
Method Details
-
rebuildTensor
public org.tensorflow.Tensor rebuildTensor()Recreates the Tensor from the serialized form.- Returns:
- The Tensor.
-
serialize
public org.tribuo.interop.tensorflow.protos.TensorTupleProto serialize()Serializes this object to a protobuf.- Returns:
- The protobuf.
-
of
Makes a TensorTuple out of this tensor.- Parameters:
tensor
- The tensor to serialize.- Returns:
- A serializable form of the Tensor.
-