Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion deepsensor/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ def compute_xarray_data_resolution(ds: Union[xr.DataArray, xr.Dataset]) -> float
"""
x1_res = np.abs(np.mean(np.diff(ds["x1"])))
x2_res = np.abs(np.mean(np.diff(ds["x2"])))
data_resolution = np.min([x1_res, x2_res])

# ensure float type, since numpy 2, np.mean returns a numpy float32
data_resolution = float(np.min([x1_res, x2_res]))
return data_resolution


Expand Down
4 changes: 2 additions & 2 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_prediction_shapes_lowlevel(self, n_target_sets):
):
task = tl("2020-01-01", context_sampling, target_sampling)

n_targets = np.product(expected_obs_shape)
n_targets = np.prod(expected_obs_shape)

# Tensors
mean = model.mean(task)
Expand Down Expand Up @@ -192,7 +192,7 @@ def test_prediction_shapes_lowlevel(self, n_target_sets):
)

if likelihood in ["cnp", "gnp"]:
n_target_dims = np.product(tl.target_dims)
n_target_dims = np.prod(tl.target_dims)
assert_shape(
model.covariance(task),
(
Expand Down
Loading