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

Function compare_traces

dali/test/python/operator_1/test_operator_origin_trace.py:102–110  ·  view source on GitHub ↗
(dali_tbs, python_tbs, end_glob=origin_trace_glob)

Source from the content-addressed store, hash-verified

100
101
102def compare_traces(dali_tbs, python_tbs, end_glob=origin_trace_glob):
103 assert len(dali_tbs) == len(python_tbs)
104 regex = fnmatch.translate(end_glob(op_mode))
105 for dali_tb, python_tb in zip(dali_tbs, python_tbs):
106 err = f"Comparing dali_tb:\n{dali_tb}\nvs python_tb:\n{python_tb}"
107 # Check if we skipped just one frame in python_tb (2 lines)
108 assert dali_tb.count("\n") == python_tb.count("\n") + 2, err
109 assert dali_tb.startswith(python_tb), err
110 assert re.match(regex, dali_tb), f"{dali_tb} didn't match the expected end traceback"
111
112
113test_modes = ["dali.fn", "dali.ops"]

Callers 4

test_trace_recursiveFunction · 0.85

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected