Skip to content

Commit

Permalink
Use multiple return statements
Browse files Browse the repository at this point in the history
  • Loading branch information
a-gardner1 committed May 20, 2024
1 parent bc26639 commit e915a79
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/function_libs/torch_lib/ops_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ def _unique_unsorted_xfail_matcher(
) -> bool:
# torch.unique always sorts, so the results are not guaranteed to be
# equivalent to the output of the ONNX op
expect_fail = False
if sample.kwargs.get("sorted", None) is False and sample.input.numel() > 1:
# sorted == None is equivalent to True
# the result will be mismatched if the input is not sorted
Expand All @@ -458,12 +457,11 @@ def _unique_unsorted_xfail_matcher(
for inv_idx in inverse.flatten().tolist():
if inv_idx not in observed:
if max_observed is not None and inv_idx < max_observed:
expect_fail = True
break
return True
observed.add(inv_idx)
if max_observed is None or inv_idx > max_observed:
max_observed = inv_idx
return expect_fail
return False


# Ops to be tested for numerical consistency between onnx and pytorch
Expand Down

0 comments on commit e915a79

Please sign in to comment.