tf_agents.utils.numpy_storage.NumpyStorage

A class to store nested objects in a collection of numpy arrays.

If a data_spec of {'foo': ArraySpec(shape=(4,), dtype=np.uint8), 'bar': ArraySpec(shape=(3, 7), dtype=np.float32)} were used, then this would create two arrays, one for the 'foo' key and one for the 'bar' key. The .get and .set methods would return/take Python dictionaries, but break down the component arrays before storing them.

data_spec An ArraySpec or a list/tuple/nest of ArraySpecs describing a single item that can be stored in this table.
capacity The maximum number of items that can be stored in the buffer.

ValueError If data_spec is not an instance or nest of ArraySpecs.

Methods

get

View source

Get value stored at idx.

set

View source

Set table_idx to value.