Package com.yahoo.tensor.serialization
Class TypedBinaryFormat
- java.lang.Object
-
- com.yahoo.tensor.serialization.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 Summary
Constructors Constructor Description TypedBinaryFormat()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Tensor
decode(java.util.Optional<TensorType> type, GrowableByteBuffer buffer)
Decode some data to a tensorstatic byte[]
encode(Tensor tensor)
-
-
-
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 databuffer
- 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
-
-