Skip to content

Commit 9c59de6

Browse files
committed
Merge pull request numpy#7505 from ahaldane/fixup_7382
MAIN: fix to numpy#7382, make scl in np.average writeable
2 parents b2d5a7b + b740018 commit 9c59de6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

numpy/lib/function_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,8 @@ def average(a, axis=None, weights=None, returned=False):
10271027
avg = np.multiply(a, wgt, dtype=result_dtype).sum(axis)/scl
10281028

10291029
if returned:
1030-
scl = np.broadcast_to(scl, avg.shape)
1030+
if scl.shape != avg.shape:
1031+
scl = np.broadcast_to(scl, avg.shape).copy()
10311032
return avg, scl
10321033
else:
10331034
return avg

0 commit comments

Comments
 (0)