Class TypedBinaryFormat

java.lang.Object
com.yahoo.tensor.serialization.TypedBinaryFormat

public class TypedBinaryFormat extends Object
Class used by clients for serializing a Tensor object into binary format or de-serializing binary data into a Tensor object. The actual binary format used is not a concern for the client and is hidden in this class and in the binary data.
Author:
geirst
  • Constructor Details

    • TypedBinaryFormat

      public TypedBinaryFormat()
  • Method Details

    • encode

      public static byte[] encode(Tensor tensor)
    • decode

      public static Tensor decode(Optional<TensorType> type, GrowableByteBuffer buffer)
      Decode some data to a tensor
      Parameters:
      type - the type to decode and validate to, or empty to use the type given in the data
      buffer - the buffer containing the data, use GrowableByteByffer.wrap(byte[]) if you have a byte array
      Returns:
      the resulting tensor
      Throws:
      IllegalArgumentException - if the tensor data was invalid