File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,9 @@ def to_scalar_or_list(v):
4949 # 0-dimensional array, but we instead want it converted to a
5050 # Python native scalar type ('float' in the example above).
5151 # We explicitly check if is has the 'item' method, which conventionally
52- # converts these types to native scalars. This guards against 'v' already being
53- # a Python native scalar type since `numpy.isscalar` would return
54- # True but `numpy.asscalar` will (oddly) raise an error is called with a
55- # a native Python scalar object.
52+ # converts these types to native scalars.
5653 if np and np .isscalar (v ) and hasattr (v , 'item' ):
57- return np . asscalar ( v )
54+ return v . item ( )
5855 if isinstance (v , (list , tuple )):
5956 return [to_scalar_or_list (e ) for e in v ]
6057 elif np and isinstance (v , np .ndarray ):
You can’t perform that action at this time.
0 commit comments