Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 18, 2024
1 parent 3ac12f4 commit c2c3186
Showing 1 changed file with 12 additions and 44 deletions.
56 changes: 12 additions & 44 deletions tests-cuda/test_3136_cuda_reducers.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,7 @@ def test_2020_reduce_axis_none_sum():
arr = ak.Array([[63.0]], backend="cuda")
assert ak.almost_equal(
ak.sum(array, axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[ak.Array([[True]], backend="cuda")]
),
ak.to_regular(arr.mask[ak.Array([[True]], backend="cuda")]),
)
assert ak.sum(array[2], axis=None, mask_identity=True) is None
del array
Expand All @@ -297,11 +295,7 @@ def test_2020_reduce_axis_none_prod():
arr = ak.Array([[4838400.0]], backend="cuda")
assert ak.almost_equal(
ak.prod(array[1:], axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[
ak.Array([[True]], backend="cuda")
]
),
ak.to_regular(arr.mask[ak.Array([[True]], backend="cuda")]),
)
assert ak.prod(array[2], axis=None, mask_identity=True) is None
del array
Expand All @@ -324,19 +318,13 @@ def test_2020_reduce_axis_none_min():
arr = ak.Array([[0.0]], backend="cuda")
assert ak.almost_equal(
ak.min(array, axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[ak.Array([[True]], backend="cuda")]
),
ak.to_regular(arr.mask[ak.Array([[True]], backend="cuda")]),
)

arr = ak.Array(ak.Array([[np.inf]], backend="cuda"))
assert ak.almost_equal(
ak.min(array[-1:], axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[
ak.Array([[False]], backend="cuda")
]
),
ak.to_regular(arr.mask[ak.Array([[False]], backend="cuda")]),
)
assert ak.min(array[2], axis=None, mask_identity=True) is None
del array
Expand All @@ -359,19 +347,13 @@ def test_2020_reduce_axis_none_max():
arr = ak.Array([[10.0]], backend="cuda")
assert ak.almost_equal(
ak.max(array, axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[ak.Array([[True]], backend="cuda")]
),
ak.to_regular(arr.mask[ak.Array([[True]], backend="cuda")]),
)

arr = ak.Array(ak.Array([[np.inf]], backend="cuda"))
assert ak.almost_equal(
ak.max(array[-1:], axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[
ak.Array([[False]], backend="cuda")
]
),
ak.to_regular(arr.mask[ak.Array([[False]], backend="cuda")]),
)
assert ak.max(array[2], axis=None, mask_identity=True) is None
del array
Expand All @@ -390,17 +372,13 @@ def test_2020_reduce_axis_none_count():
arr = ak.Array([[12]], backend="cuda")
assert ak.almost_equal(
ak.count(array, axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[ak.Array([[True]], backend="cuda")]
),
ak.to_regular(arr.mask[ak.Array([[True]], backend="cuda")]),
)

arr = ak.Array([[0]], backend="cuda")
assert ak.almost_equal(
ak.count(array[-1:], axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[ak.Array([[False]], backend="cuda")]
),
ak.to_regular(arr.mask[ak.Array([[False]], backend="cuda")]),
)
assert ak.count(array[2], axis=None, mask_identity=True) is None
assert ak.count(array[2], axis=None, mask_identity=False) == 0
Expand All @@ -420,17 +398,13 @@ def test_2020_reduce_axis_none_count_nonzero():
arr = ak.Array([[11]], backend="cuda")
assert ak.almost_equal(
ak.count_nonzero(array, axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[ak.Array([[True]], backend="cuda")]
),
ak.to_regular(arr.mask[ak.Array([[True]], backend="cuda")]),
)

arr = ak.Array([[0]], backend="cuda")
assert ak.almost_equal(
ak.count_nonzero(array[-1:], axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[ak.Array([[False]], backend="cuda")]
),
ak.to_regular(arr.mask[ak.Array([[False]], backend="cuda")]),
)
assert ak.count_nonzero(array[2], axis=None, mask_identity=True) is None
assert ak.count_nonzero(array[2], axis=None, mask_identity=False) == 0
Expand All @@ -444,9 +418,7 @@ def test_2020_reduce_axis_none_std_no_mask_axis_none():
out1 = ak.std(array[-1:], axis=None, keepdims=True, mask_identity=True)

arr = ak.Array([[0.0]], backend="cuda")
out2 = ak.to_regular(
arr.mask[ak.Array([[False]], backend="cuda")]
)
out2 = ak.to_regular(arr.mask[ak.Array([[False]], backend="cuda")])
assert ak.almost_equal(out1, out2)

out3 = ak.std(array[2], axis=None, mask_identity=True)
Expand All @@ -468,11 +440,7 @@ def test_2020_reduce_axis_none_std():
arr = ak.Array([[3.139134700306227]], backend="cuda")
cpt.assert_allclose(
ak.std(array, axis=None, keepdims=True, mask_identity=True),
ak.to_regular(
arr.mask[
ak.Array([[True]], backend="cuda")
]
),
ak.to_regular(arr.mask[ak.Array([[True]], backend="cuda")]),
)
assert np.isnan(ak.std(array[2], axis=None, mask_identity=False))
del array

0 comments on commit c2c3186

Please sign in to comment.