Skip to content

Commit 4fa1d1a

Browse files
committed
uint64 discrete actions
1 parent 48eea05 commit 4fa1d1a

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

amago/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def get_actions(
763763
actions = action_dists.mean
764764
# get intended gamma distribution (always in -1 idx)
765765
actions = actions[..., -1, :]
766-
dtype = torch.uint8 if (self.discrete or self.multibinary) else torch.float32
766+
dtype = torch.int64 if (self.discrete or self.multibinary) else torch.float32
767767
return actions.to(dtype=dtype), hidden_state
768768

769769
@torch.no_grad()

amago/envs/env_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def action(self, action):
141141
if isinstance(action, int):
142142
return action
143143
elif isinstance(action, np.ndarray) and action.ndim == 1:
144-
assert action.shape[0] == 1 and action.dtype == np.uint8
144+
assert action.shape[0] == 1
145145
return action[0].item()
146146
elif isinstance(action, np.ndarray) and action.ndim == 2:
147147
assert action.shape[1] == 1

amago/envs/exploration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def add_exploration_noise(self, action: np.ndarray, local_step: np.ndarray):
205205
use_random = np.expand_dims(self.rng.random(self.batched_envs) <= noise, 1)
206206
expl_action = (
207207
use_random * random_action + (1 - use_random) * action
208-
).astype(np.uint8)
208+
).astype(np.int64)
209209
assert expl_action.shape == (self.batched_envs, 1)
210210
else:
211211
# random noise (TD3-style)

0 commit comments

Comments
 (0)