Skip to content

Commit

Permalink
Fix argmax,argmin dim checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Holl committed Aug 9, 2024
1 parent 79322b6 commit 9858107
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions phiml/math/_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ def argmax(x: Tensor, dim: DimFilter, index_dim=channel('index')):
"""
dims = x.shape.only(dim)
keep = x.shape.without(dims)
assert dim, f"No dimensions {dim} present on key {x.shape}"
assert dims, f"argmax requires dim to be present on data but {dim} does not exist on {x.shape}"
if isinstance(x, (SparseCoordinateTensor, CompressedSparseMatrix)):
if dims in sparse_dims(x):
max_val = max_(x, dim)
Expand Down Expand Up @@ -1740,7 +1740,7 @@ def argmin(x: Tensor, dim: DimFilter, index_dim=channel('index')):
"""
dims = x.shape.only(dim)
keep = x.shape.without(dims)
assert dim, f"No dimensions {dim} present on key {x.shape}"
assert dims, f"argmin requires dim to be present on data but {dim} does not exist on {x.shape}"
if isinstance(x, (SparseCoordinateTensor, CompressedSparseMatrix)):
if dims in sparse_dims(x):
min_val = min_(x, dim)
Expand Down

0 comments on commit 9858107

Please sign in to comment.