Class TypedBinaryFormat


  • public class TypedBinaryFormat
    extends java.lang.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 Detail

      • TypedBinaryFormat

        public TypedBinaryFormat()
    • Method Detail

      • encode

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

        public static Tensor decode​(java.util.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:
        java.lang.IllegalArgumentException - if the tensor data was invalid