Skip to content

Commit

Permalink
checks whether user-defined function returns the expected type
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdviviano committed Feb 24, 2024
1 parent ccfa959 commit 1a5ad2c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gfn/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ def _step(
not_done_actions = actions[~new_sink_states_idx]

new_not_done_states_tensor = self.step(not_done_states, not_done_actions)
if not isinstance(new_not_done_states_tensor, torch.Tensor):
raise Exception(
"User implemented env.step function *must* return a torch.Tensor!"
)

new_states.tensor[~new_sink_states_idx] = new_not_done_states_tensor

Expand Down

0 comments on commit 1a5ad2c

Please sign in to comment.