gfn.containers.replay_buffer

Module Contents

Classes

ReplayBuffer

A replay buffer of trajectories or transitions.

class gfn.containers.replay_buffer.ReplayBuffer(env, objects_type, capacity=1000)

A replay buffer of trajectories or transitions.

Parameters
  • env (gfn.env.Env) –

  • objects_type (Literal[transitions, trajectories, states]) –

  • capacity (int) –

env

the Environment instance.

loss_fn

the Loss instance

capacity

the size of the buffer.

training_objects

the buffer of objects used for training.

terminating_states

a States class representation of \(s_f\).

objects_type

the type of buffer (transitions, trajectories, or states).

__len__()
__repr__()

Return repr(self).

add(training_objects)

Adds a training object to the buffer.

Parameters

training_objects (Transitions | Trajectories | tuple[States]) –

load(directory)

Loads the buffer from disk.

Parameters

directory (str) –

sample(n_trajectories)

Samples n_trajectories training objects from the buffer.

Parameters

n_trajectories (int) –

Return type

Transitions | Trajectories | tuple[States]

save(directory)

Saves the buffer to disk.

Parameters

directory (str) –