Skip to content

Commit

Permalink
fix(backport): Replace deprecated np.product by np.prod
Browse files Browse the repository at this point in the history
* Backport PR #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
  • Loading branch information
alexander-held authored and matthewfeickert committed Aug 16, 2023
1 parent 3639975 commit beb0c34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/examples/notebooks/pytorch_tests_onoff.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
" self.auxdata.append(bkg_over_bsq)\n",
"\n",
" def alphas(self, pars):\n",
" return np.product([pars, self.bkg_over_db_squared], axis=0)\n",
" return np.prod([pars, self.bkg_over_db_squared], axis=0)\n",
"\n",
" def logpdf(self, a, alpha):\n",
" return _log_poisson_impl(a, alpha)\n",
Expand Down
2 changes: 1 addition & 1 deletion src/pyhf/tensor/numpy_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def sum(self, tensor_in: Tensor[T], axis: int | None = None) -> ArrayLike:
return np.sum(tensor_in, axis=axis)

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

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

0 comments on commit beb0c34

Please sign in to comment.