skip test_trace_c10_ops if _caffe2 is not built (#19099)
authorLu Fang <lufang@fb.com>
Fri, 19 Apr 2019 06:31:32 +0000 (23:31 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 19 Apr 2019 06:40:15 +0000 (23:40 -0700)
Summary:
fix https://github.com/pytorch/pytorch/issues/18142
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19099

Differential Revision: D15010452

Pulled By: houseroad

fbshipit-source-id: 5bf158d7fce7bfde109d364a3a9c85b83761fffb

test/test_jit.py

index 67c7f49..b66a156 100644 (file)
@@ -1772,6 +1772,11 @@ graph(%x : Tensor,
         FileCheck().check("mul").check("add").run(str(trace))
 
     def test_trace_c10_ops(self):
+        try:
+            _ = torch.ops._caffe2.GenerateProposals
+        except RuntimeError:
+            self.skipTest("Skip the test since c2 ops are not registered.")
+
         class MyModel(torch.nn.Module):
             def __init__(self):
                 super(MyModel, self).__init__()