Skip to content

Commit a25f196

Browse files
fix: Replace deprecated np.product by np.prod (#2242)
* Use np.prod API over np.product as np.product is deprecated as of NumPy v1.25.0. - c.f. https://numpy.org/devdocs/release/1.25.0-notes.html#deprecations
1 parent 951912f commit a25f196

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/examples/notebooks/pytorch_tests_onoff.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
" self.auxdata.append(bkg_over_bsq)\n",
3636
"\n",
3737
" def alphas(self, pars):\n",
38-
" return np.product([pars, self.bkg_over_db_squared], axis=0)\n",
38+
" return np.prod([pars, self.bkg_over_db_squared], axis=0)\n",
3939
"\n",
4040
" def logpdf(self, a, alpha):\n",
4141
" return _log_poisson_impl(a, alpha)\n",

src/pyhf/tensor/numpy_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def sum(self, tensor_in: Tensor[T], axis: int | None = None) -> ArrayLike:
254254
return np.sum(tensor_in, axis=axis)
255255

256256
def product(self, tensor_in: Tensor[T], axis: Shape | None = None) -> ArrayLike:
257-
return np.product(tensor_in, axis=axis) # type: ignore[arg-type]
257+
return np.prod(tensor_in, axis=axis) # type: ignore[arg-type]
258258

259259
def abs(self, tensor: Tensor[T]) -> ArrayLike:
260260
return np.abs(tensor)

0 commit comments

Comments
 (0)