Skip to content

Commit

Permalink
fix ndarray behavior dict_to_array
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyes319 committed Nov 1, 2024
1 parent 0764dab commit 74ecfda
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mace/tools/scripts_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,9 @@ def custom_key(key):


def dict_to_array(input_data, heads):
if not all(isinstance(value, dict) for value in input_data.values()):
if all(isinstance(value, np.ndarray) for value in input_data.values()):
return np.array([input_data[head] for head in heads])
elif not all(isinstance(value, dict) for value in input_data.values()):
return np.array([[input_data[head]] for head in heads])
unique_keys = set()
for inner_dict in input_data.values():
Expand Down

0 comments on commit 74ecfda

Please sign in to comment.