Skip to content

Commit

Permalink
fix(lixuelin): to_ndarray fails to assign dtype for scalars (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxl2gf authored Aug 18, 2023
1 parent aec6e9c commit bc3ecd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ding/torch_utils/data_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ def transform(d):
elif isinstance(item, bool) or isinstance(item, str):
return item
elif np.isscalar(item):
return np.array(item)
if dtype is None:
return np.array(item)
else:
return np.array(item, dtype=dtype)
elif item is None:
return None
else:
Expand Down

0 comments on commit bc3ecd9

Please sign in to comment.