You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would like to add a set of options to Nx.Defn.Evaluator that allow users to either print to the screen or save to disk the values of each unique Nx.Defn.Expr node during evaluation. This feature should ensure that each node is only printed/saved once, even if it is cached and reused multiple times in the computation graph.
Motivation
Debugging and understanding complex computation graphs in Nx can be challenging, especially when expressions are reused and cached. Having the ability to inspect the operation, arguments, and resulting value of each unique node—either by printing them or saving them to disk—would greatly aid in debugging, profiling, and educational use cases.
Desired Behavior
We will add the :debug_options key as a Nx.Defn compiler option.
It has the following inner options:
:inspect_limit (integer): Limit the number of elements shown in the inspected result (passed to inspect/2).
:save_path (string): Directory path to save the inspected results (if :save is chosen). If not provided, the results will be printed to stdout.
Each node (identified by its unique id in the computation graph) should only be printed/saved once, even if it is cached and reused.
Format:
Text representation: Output should be similar to the following:
We would like to add a set of options to
Nx.Defn.Evaluator
that allow users to either print to the screen or save to disk the values of each uniqueNx.Defn.Expr
node during evaluation. This feature should ensure that each node is only printed/saved once, even if it is cached and reused multiple times in the computation graph.Motivation
Debugging and understanding complex computation graphs in Nx can be challenging, especially when expressions are reused and cached. Having the ability to inspect the operation, arguments, and resulting value of each unique node—either by printing them or saving them to disk—would greatly aid in debugging, profiling, and educational use cases.
Desired Behavior
We will add the
:debug_options
key as a Nx.Defn compiler option.It has the following inner options:
:inspect_limit
(integer): Limit the number of elements shown in the inspected result (passed toinspect/2
).:save_path
(string): Directory path to save the inspected results (if:save
is chosen). If not provided, the results will be printed to stdout.Each node (identified by its unique id in the computation graph) should only be printed/saved once, even if it is cached and reused.
node_123.txt
) in the specified directory.Example Usage
Implementation Notes
Additional Context
This feature would be especially useful for:
The text was updated successfully, but these errors were encountered: