Skip to content

Commit

Permalink
Merge pull request #485 from aai-institute/bugfix/484-type-error-dask
Browse files Browse the repository at this point in the history
Bug in handling single dimensional arrays in DaskInfluenceCalculator
  • Loading branch information
schroedk authored Jan 2, 2024
2 parents 7b455a8 + ff3ae7b commit 17c97c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Unreleased

### Fixed

- Bug in using `DaskInfluenceCalcualator` with `TorchnumpyConverter`
for single dimensional arrays [PR #485](https://github.com/aai-institute/pyDVL/pull/485)

## 0.8.0 - 🆕 New interfaces, scaling computation, bug fixes and improvements 🎁

### Added
Expand Down
18 changes: 9 additions & 9 deletions src/pydvl/influence/influence_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ def func(x_numpy: NDArray, y_numpy: NDArray, model: InfluenceFunctionModel):
chunk_shape = (chunk_size, self.n_parameters)
chunk_array = da.from_delayed(
delayed(func)(
x_chunk.squeeze().tolist(),
y_chunk.squeeze().tolist(),
x_chunk.squeeze()[()],
y_chunk.squeeze()[()],
self.influence_function_model,
),
dtype=x.dtype,
Expand Down Expand Up @@ -400,10 +400,10 @@ def func(

block_array = da.from_delayed(
delayed(func)(
x_test_chunk.squeeze().tolist(),
y_test_chunk.squeeze().tolist(),
x_chunk.squeeze().tolist(),
y_chunk.squeeze().tolist(),
x_test_chunk.squeeze()[()],
y_test_chunk.squeeze()[()],
x_chunk.squeeze()[()],
y_chunk.squeeze()[()],
self.influence_function_model,
),
shape=block_shape,
Expand Down Expand Up @@ -506,9 +506,9 @@ def func(

block_array = da.from_delayed(
delayed(func)(
z_test_chunk.squeeze().tolist(),
x_chunk.squeeze().tolist(),
y_chunk.squeeze().tolist(),
z_test_chunk.squeeze()[()],
x_chunk.squeeze()[()],
y_chunk.squeeze()[()],
self.influence_function_model,
),
shape=block_shape,
Expand Down

0 comments on commit 17c97c1

Please sign in to comment.