tvm
tvm copied to clipboard
[Utility][Relax] Implemented InjectDebugCallback transform
In general, intermediate values produced while evaluating Relax functions are not visible to an end user. While this provides stronger guarantees to the compiler, it can make debugging difficult. For example, if an end-to-end model is producing incorrect results, it can be difficult to determine which step of the model first introduced an error.
This commit implements relax.transform.InjectDebugCallback, which adds a debug_callback parameter to each externally-exposed function of an IRModule. This callback is called with the name and value of each variable binding within the function bodies, allowing error-checking to be added. For example, a binding of B = R.add(A,A) would be followed by debug_callback("B", B).