From 57aee9f459fdb23ff776834921fa9488e517a54f Mon Sep 17 00:00:00 2001 From: Chi Chen Date: Mon, 20 May 2019 14:52:09 -0700 Subject: [PATCH] add numpy target support --- megnet/utils/general_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/megnet/utils/general_utils.py b/megnet/utils/general_utils.py index 10bcab622..d63984675 100644 --- a/megnet/utils/general_utils.py +++ b/megnet/utils/general_utils.py @@ -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] @@ -20,4 +22,4 @@ def expand_1st(x): Returns: (np.array) """ - return np.expand_dims(x, axis=0) \ No newline at end of file + return np.expand_dims(x, axis=0)