in monobeast/minigrid/monobeast_amigo.py [0:0]
def create_buffers(obs_shape, num_actions, flags, width, height, logits_size) -> Buffers:
T = flags.unroll_length
specs = dict(
frame=dict(size=(T + 1, *obs_shape), dtype=torch.uint8),
reward=dict(size=(T + 1,), dtype=torch.float32),
done=dict(size=(T + 1,), dtype=torch.bool),
episode_return=dict(size=(T + 1,), dtype=torch.float32),
episode_step=dict(size=(T + 1,), dtype=torch.int32),
last_action=dict(size=(T + 1,), dtype=torch.int64),
policy_logits=dict(size=(T + 1, num_actions), dtype=torch.float32),
baseline=dict(size=(T + 1,), dtype=torch.float32),
generator_baseline=dict(size=(T + 1,), dtype=torch.float32),
action=dict(size=(T + 1,), dtype=torch.int64),
episode_win=dict(size=(T + 1,), dtype=torch.int32),
generator_logits=dict(size=(T + 1, logits_size), dtype=torch.float32),
goal=dict(size=(T + 1,), dtype=torch.int64),
initial_frame=dict(size=(T + 1, *obs_shape), dtype=torch.uint8),
carried_col =dict(size=(T + 1,), dtype=torch.int64),
carried_obj =dict(size=(T + 1,), dtype=torch.int64),
)
buffers: Buffers = {key: [] for key in specs}
for _ in range(flags.num_buffers):
for key in buffers:
buffers[key].append(torch.empty(**specs[key]).share_memory_())
return buffers