Skip to content

Commit 1af7fe8

Browse files
committed
Fix test
1 parent c3c0da3 commit 1af7fe8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

exir/program/test/test_program.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,16 +537,18 @@ def _test_edge_dialect_verifier(self, callable, validate_ir=True):
537537
_ = to_edge(exported_foo, compile_config=edge_compile_config)
538538

539539
def test_edge_dialect_custom_op(self):
540+
# We shouldn't error out if there's a custom op in the graph.
540541
def _use_foo_add(a: torch.Tensor, b: torch.Tensor):
541542
return torch.ops.exir_program_test_op.foo(a, b)
542543

543544
from torch._export.verifier import SpecViolationError
544545

545-
with self.assertRaises(SpecViolationError):
546+
try:
547+
# This should not raise error
546548
self._test_edge_dialect_verifier(_use_foo_add)
547-
548-
# This should not raise error
549-
self._test_edge_dialect_verifier(_use_foo_add, False)
549+
self._test_edge_dialect_verifier(_use_foo_add, False)
550+
except SpecViolationError:
551+
self.fail("Should not error out on custom op")
550552

551553
def _test_model_with_non_decomp_partitioner(self, model: torch.nn.Module):
552554
# This is the pre-dispatch export that we will be switching to primarily

0 commit comments

Comments
 (0)