Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
add numpy target support
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi Chen committed May 20, 2019
1 parent f8bbc43 commit 57aee9f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion megnet/utils/general_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def to_list(x):
"""
if isinstance(x, list) or isinstance(x, tuple):
return x
elif isinstance(x, np.ndarray):
return to_list(x.tolist())
else:
return [x]

Expand All @@ -20,4 +22,4 @@ def expand_1st(x):
Returns:
(np.array)
"""
return np.expand_dims(x, axis=0)
return np.expand_dims(x, axis=0)

0 comments on commit 57aee9f

Please sign in to comment.