def test_find_dangling_impls(self): dangling_impls = C._dispatch_find_dangling_impls() self.assertEqual( 0, len(dangling_impls), msg=f"Expect zero dangling impls, but found: {dangling_impls}" )
def test_find_dangling_impls_ext(self): extension_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'cpp_extensions', 'dangling_impl_extension.cpp') module = torch.utils.cpp_extension.load( name="dangling_impl_extension", sources=[ extension_path, ], extra_cflags=["-g"], verbose=True, ) impls = C._dispatch_find_dangling_impls() self.assertEqual(1, len(impls)) self.assertEqual( '''\ name: __test::foo schema: (none) CPU: registered at {}:5 :: () -> () [ boxed unboxed ] '''.format(extension_path), impls[0])