Module: tf_quant_finance.experimental.io

Contents

Last updated: 2023-03-16.

Module: tf_quant_finance.experimental.io#

View source

Utilities to serialize and deserialize dictionaries of numpy arrays.

This module defines generic reader and writer for serialized data as well as specialized methods to export collections of numpy arrays to files. The latter is based on TFRecords format. The main difference is that instead of directly storing elements in FloatList (or IntList etc) protos, it first serializes them to bytes and then stores them as a single element BytesList. This is necessary to improve deserialization performance when we have large arrays.

Classes#

class ArrayDictReader: Iterator over the data serialized by ArrayDictWriter.

class ArrayDictWriter: Writer to write dictionaries of numpy arrays in binary format.

Functions#

decode_array(...): Decodes a bytestring into a numpy array.

encode_array(...): Encodes a numpy array using TensorProto protocol buffer.