Package com.yahoo.tensor.serialization
Class TypedBinaryFormat
java.lang.Object
com.yahoo.tensor.serialization.TypedBinaryFormat
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic Tensor
decode
(Optional<TensorType> type, GrowableByteBuffer buffer) Decode some data to a tensorstatic byte[]
static GrowableByteBuffer
encode
(Tensor tensor, GrowableByteBuffer buffer)
-
Constructor Details
-
TypedBinaryFormat
public TypedBinaryFormat()
-
-
Method Details
-
encode
-
encode
-
decode
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:
IllegalArgumentException
- if the tensor data was invalid
-