Skip to content

Commit

Permalink
Fix check_estimator_sparse_array
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuele Guidotti committed Jul 19, 2024
1 parent d641bbf commit 569c439
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
include:
- os: macos-10.15
python-version: ["3.6", "3.7"]
- os: ubuntu-20.04
python-version: "3.6"
exclude:
- os: ubuntu-latest
python-version: "3.6"
- os: windows-latest
python-version: "3.6"
python-version: ["3.6", "3.7"]
- os: windows-2019
python-version: ["3.6", "3.7"]

runs-on: ${{ matrix.os }}

Expand Down
8 changes: 7 additions & 1 deletion bornrule/born.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ def _weights(self):

def _sum(self, x, axis):
if self._sparse().issparse(x):
return x.sum(axis=axis)
x = x.sum(axis=axis)
if x.ndim != 1:
return x
if axis == 0:
return x.reshape((1,) + x.shape)
if axis == 1:
return x.reshape(x.shape + (1,))

return self._dense().asarray(x).sum(axis=axis, keepdims=True)

Expand Down

0 comments on commit 569c439

Please sign in to comment.