Skip to content

Commit abfa21a

Browse files
authored
Issue 107 return types (#109)
* Add DSS to Docs * Wrap all ES in the lazy_gufunc_wrapper * explicitly cast array of shape () to the item type * Revert "Wrap all ES in the lazy_gufunc_wrapper" This reverts commit 89ff80a.
1 parent bb39be1 commit abfa21a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scoringrules/core/utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def lazy_gufunc_wrapper_uv(func):
4545
def wrapper(*args):
4646
out = np.empty_like(args[0])
4747
func(*args, out)
48-
return out
48+
if out.shape == ():
49+
return out.item()
50+
else:
51+
return out
4952

5053
return wrapper
5154

@@ -62,6 +65,9 @@ def lazy_gufunc_wrapper_mv(func):
6265
def wrapper(*args):
6366
out = np.empty_like(args[0][..., 0])
6467
func(*args, out)
65-
return out
68+
if out.shape == ():
69+
return out.item()
70+
else:
71+
return out
6672

6773
return wrapper

0 commit comments

Comments
 (0)