MCPcopy Create free account
hub / github.com/NVIDIA/DALI / _test_schema_name_for_module

Function _test_schema_name_for_module

dali/test/python/test_functional_api.py:198–216  ·  view source on GitHub ↗

Sanity test if we didn't miss the _schema_name for any op with custom wrapper

(module_name, base_name="")

Source from the content-addressed store, hash-verified

196
197
198def _test_schema_name_for_module(module_name, base_name=""):
199 """Sanity test if we didn't miss the _schema_name for any op with custom wrapper"""
200 if module_name.endswith("hidden"):
201 return
202 if base_name == "":
203 base_name = module_name
204 dali_module = sys.modules[module_name]
205 for member_name in dir(dali_module):
206 if member_name.startswith("_"):
207 continue
208 member = getattr(dali_module, member_name)
209 if inspect.isfunction(member):
210 # Check if we can reconstruct the name of the op from provided schema
211 assert hasattr(member, "_schema_name")
212 full_name = ops._op_name(member._schema_name)
213 assert base_name + "." + full_name == module_name + "." + member_name
214 elif inspect.ismodule(member) and (module_name + "." + member_name) in sys.modules.keys():
215 # Recurse on DALI submodule (filter out non-DALI reexported modules like `sys`)
216 _test_schema_name_for_module(module_name + "." + member_name, base_name)
217
218
219def test_schema_name():

Callers 3

test_schema_nameFunction · 0.85
test_schema_name_torchFunction · 0.85
test_schema_name_numbaFunction · 0.85

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected