Class TensorFlowUtil.TensorTuple

java.lang.Object
org.tribuo.interop.tensorflow.TensorFlowUtil.TensorTuple
All Implemented Interfaces:
Serializable
Enclosing class:
TensorFlowUtil

public static final class TensorFlowUtil.TensorTuple extends Object implements Serializable
A serializable tuple containing the tensor class name, the shape and the data.

It's almost a record.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    The tensor class name.
    final byte[]
    The tensor data.
    final long[]
    The shape of the tensor.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TensorTuple(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 Type
    Method
    Description
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • className

      public final String className
      The tensor class name.
    • shape

      public final long[] shape
      The shape of the tensor.
    • data

      public final byte[] data
      The tensor data.
  • Constructor Details

    • TensorTuple

      public TensorTuple(String className, long[] shape, byte[] data)
      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

      public static TensorFlowUtil.TensorTuple of(org.tensorflow.types.family.TType tensor)
      Makes a TensorTuple out of this tensor.
      Parameters:
      tensor - The tensor to serialize.
      Returns:
      A serializable form of the Tensor.