fragile.callbacks.memory#

Module Contents#

Classes#

ReplayMemory

Replay buffer that contains data collected from algorithm runs.

class fragile.callbacks.memory.ReplayMemory(max_size, names=None, min_size=None, **kwargs)[source]#

Bases: fragile.core.api_classes.Callback

Replay buffer that contains data collected from algorithm runs.

Parameters
  • max_size (int) –

  • names (Union[List[str], Tuple[str]]) –

  • min_size (int) –

name = memory#
_log#
__len__()[source]#
Return type

int

__repr__()[source]#

Return repr(self).

Return type

str

setup(swarm)[source]#

Prepare the component during the setup phase of the Swarm.

reset(*args, **kwargs)[source]#

Delete all the data previously stored in the memory.

after_env()[source]#
get_value(name)[source]#

Get attributes of the memory.

is_ready()[source]#

Return True if the number of experiences in the memory is greater than min_size.

Return type

bool

get_values()[source]#

Return a tuple containing the memorized data for all the saved data attributes.

Return type

Tuple[fragile.core.typing.Tensor, Ellipsis]

as_dict()[source]#
Return type

Dict[str, fragile.core.typing.Tensor]

iterate_batches(batch_size, as_dict=True)[source]#
Parameters
  • batch_size (int) –

  • as_dict (bool) –

iterate_values(randomize=False)[source]#

Return a generator that yields a tuple containing the data of each state stored in the memory.

Parameters

randomize (bool) –

Return type

Iterable[Tuple[fragile.core.typing.Tensor]]

append(**kwargs)[source]#