Skip to content

Commit 75d29af

Browse files
authored
Fix OpInfo correctness tests not being accessible due to generator exhaustion (#106)
1 parent 1839f4b commit 75d29af

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

BackendBench/eval.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def eval_correctness(op, impl, tests):
6161
if eval_correctness_test(op, impl, test):
6262
correct += 1
6363
total += 1
64+
65+
# Handle the case where no tests are available
66+
if total == 0:
67+
logger.warning(f"No correctness tests available for {str(op)}")
68+
return 0.0
69+
6470
return correct / total
6571

6672

BackendBench/suite/opinfo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ def build_op_tests(device, dtype, filter=None):
8484

8585
for overload, indices in op_indices.items():
8686
if len(indices) > 0:
87-
op_info_op_tests.append(
88-
OpInfoOpTest(overload, op.sample_inputs(device, dtype), indices)
89-
)
87+
op_info_op_tests.append(OpInfoOpTest(overload, sample_inputs, indices))
9088

9189
return op_info_op_tests
9290

0 commit comments

Comments
 (0)