zentorch Logging and Debugging - 57300

ZenDNN User Guide (57300)

Document ID
57300
Release Date
2025-08-18
Revision
5.1 English

For zentorch, enable CPP specific logging by setting the environment variable TORCH_CPP_LOG_LEVEL. This has four levels: INFO, WARNING, ERROR and FATAL in decreasing order of verbosity.

Similarly, enable Python logging by setting the environment variable ZENTORCH_PY_LOG_LEVEL. This has five levels: DEBUG, INFO, WARNING, ERROR, and CRITICAL, again in decreasing order of verbosity.

Here is an example of how to enable INFO level logs for cpp and DEBUG level for Python (most verbose):
export TORCH_CPP_LOG_LEVEL=INFO 
export ZENTORCH_PY_LOG_LEVEL=DEBUG
WARNING is the default level of logs for both cpp and Python sources, but it can be overridden.
Note: The log levels are the same as those provided by the Python logging module.

INFO: As all Operators implemented in zentorch are registered with torch using the TORCH_LIBRARY() and TORCH_LIBRARY_IMPL() macros in bindings, the PyTorch profiler can be used without any modification to measure the operator level performance.