Skip to content

Commit

Permalink
fix(nyz): fix structured action bug (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaParaZz1 committed Dec 21, 2023
1 parent 9116ba6 commit a2b5ab7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ding/policy/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def default_preprocess_learn(
the following model forward and loss computation.
"""
# data preprocess
if data[0]['action'].dtype in [np.int64, torch.int64]:
elem = data[0]
if isinstance(elem['action'], torch.Tensor) and elem['action'].dtype in [np.int64, torch.int64]:
data = default_collate(data, cat_1dim=True) # for discrete action
else:
data = default_collate(data, cat_1dim=False) # for continuous action
Expand Down

0 comments on commit a2b5ab7

Please sign in to comment.