Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ab5fa39

Browse files
[pre-commit.ci] pre-commit autoupdate (#191)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.6 → v3.0.0-alpha.9-for-vscode](pre-commit/mirrors-prettier@v3.0.0-alpha.6...v3.0.0-alpha.9-for-vscode) - [github.com/pre-commit/mirrors-mypy: v1.1.1 → v1.4.1](pre-commit/mirrors-mypy@v1.1.1...v1.4.1) * Use np.prod instead of np.product Remove usage of `np.product` that was deprecated in numpy 1.25.0, see numpy/numpy#23314. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Wei Ji <[email protected]>
1 parent 26b04fc commit ab5fa39

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ repos:
3232
- id: isort
3333

3434
- repo: https://github.com/pre-commit/mirrors-prettier
35-
rev: v3.0.0-alpha.6
35+
rev: v3.0.0-alpha.9-for-vscode
3636
hooks:
3737
- id: prettier
3838

3939
- repo: https://github.com/pre-commit/mirrors-mypy
40-
rev: v1.1.1
40+
rev: v1.4.1
4141
hooks:
4242
- id: mypy
4343
additional_dependencies: [

xbatcher/generators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def _gen_empty_batch_selectors(self) -> BatchSelectorSet:
192192
Create an empty batch selector set that can be populated by appending
193193
patches to each batch.
194194
"""
195-
n_batches = np.product(list(self._n_batches_per_dim.values()))
195+
n_batches = np.prod(list(self._n_batches_per_dim.values()))
196196
return {k: [] for k in range(n_batches)}
197197

198198
def _gen_patch_numbers(self, ds: Union[xr.DataArray, xr.Dataset]):

xbatcher/testing.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ def _get_sample_length(
109109
else:
110110
batch_concat_dims = []
111111
return int(
112-
np.product(list(non_specified_ds_dims.values()))
113-
* np.product(list(non_input_batch_dims.values()))
114-
* np.product(batch_concat_dims)
112+
np.prod(list(non_specified_ds_dims.values()))
113+
* np.prod(list(non_input_batch_dims.values()))
114+
* np.prod(batch_concat_dims)
115115
)
116116

117117

@@ -209,7 +209,7 @@ def _get_nbatches_from_input_dims(generator: BatchGenerator) -> int:
209209
s : int
210210
Number of batches expected given ``input_dims`` and ``input_overlap``.
211211
"""
212-
nbatches_from_input_dims = np.product(
212+
nbatches_from_input_dims = np.prod(
213213
[
214214
generator.ds.sizes[dim] // length
215215
for dim, length in generator.input_dims.items()
@@ -218,7 +218,7 @@ def _get_nbatches_from_input_dims(generator: BatchGenerator) -> int:
218218
]
219219
)
220220
if generator.input_overlap:
221-
nbatches_from_input_overlap = np.product(
221+
nbatches_from_input_overlap = np.prod(
222222
[
223223
(generator.ds.sizes[dim] - overlap)
224224
// (generator.input_dims[dim] - overlap)
@@ -242,13 +242,13 @@ def validate_generator_length(generator: BatchGenerator) -> None:
242242
"""
243243
non_input_batch_dims = _get_non_input_batch_dims(generator)
244244
duplicate_batch_dims = _get_duplicate_batch_dims(generator)
245-
nbatches_from_unique_batch_dims = np.product(
245+
nbatches_from_unique_batch_dims = np.prod(
246246
[
247247
generator.ds.sizes[dim] // length
248248
for dim, length in non_input_batch_dims.items()
249249
]
250250
)
251-
nbatches_from_duplicate_batch_dims = np.product(
251+
nbatches_from_duplicate_batch_dims = np.prod(
252252
[
253253
generator.ds.sizes[dim] // length
254254
for dim, length in duplicate_batch_dims.items()

0 commit comments

Comments
 (0)