Package com.yahoo.tensor.serialization
Class JsonFormat
java.lang.Object
com.yahoo.tensor.serialization.JsonFormat
Writes tensors on the JSON format used in Vespa tensor document fields:
A JSON map containing a 'cells' or 'values' array.
See
https://docs.vespa.ai/en/reference/document-json-format.html
- Author:
- bratseth
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Tensor
decode
(TensorType type, byte[] jsonTensorValue) Deserializes the given tensor from JSON formatstatic double[]
decodeHexString
(String input, TensorType.Value valueType) static byte[]
Serializes the given tensor value into JSON formatstatic byte[]
encodeShortForm
(Tensor tensor) Serializes the given tensor type and value into a short-form JSON formatstatic byte[]
encodeWithType
(Tensor tensor) Serializes the given tensor type and value into JSON format
-
Constructor Details
-
JsonFormat
public JsonFormat()
-
-
Method Details
-
encode
Serializes the given tensor value into JSON format -
encodeWithType
Serializes the given tensor type and value into JSON format -
encodeShortForm
Serializes the given tensor type and value into a short-form JSON format -
decode
Deserializes the given tensor from JSON format -
decodeHexString
-