Unverified Commit 3892d09f authored by Meng Zhou's avatar Meng Zhou Committed by GitHub
Browse files

update to_py_obj to support np.number (#14064)


Co-authored-by: default avatar眸浩 <mouhao.zm@alibaba-inc.com>
parent 122c2f81
......@@ -1946,7 +1946,7 @@ def to_py_obj(obj):
return obj.detach().cpu().tolist()
elif is_flax_available() and _is_jax(obj):
return np.asarray(obj).tolist()
elif isinstance(obj, np.ndarray):
elif isinstance(obj, (np.ndarray, np.number)): # tolist also works on 0d np arrays
return obj.tolist()
else:
return obj
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment