Dynamo.explain() output

ysna: <p>I just wonder that what is the meaning of _compile.compile_inner.<br>
I mean I wonder what _compile.compile_inner is related to.<br>
The _compile.compile_inner time is on very bottom of this page.</p>
<p><strong>My code is under here.</strong></p>
<pre><code class="lang-auto">import torch
from torch import _dynamo as dynamo

def toy_example(a, b):
    x = a/(torch.abs(a) + 1)
    print("wow")
    print(b.sum())
    print("good")
    if b.sum() &lt; 0:
        b = b * -1
        print("wowowow")
        print(b.sum()&gt; 0)
    if b.sum() == 0:
        b = b + 1
        print("wowowowo")
    print("great")
    return x * b


explanation = dynamo.explain(toy_example)(torch.randn(5), torch.randn(5))
print(explanation)
</code></pre>
<p><strong>And my dynamo.explain() output is like this.</strong></p>
<p>wow<br>
tensor(-1.4872)<br>
good<br>
wowowow<br>
tensor(True)<br>
great<br>
Graph Count: 7<br>
Graph Break Count: 6<br>
Op Count: 8<br>
Break Reasons:<br>
Break Reason 1:<br>
Reason: builtin: print [&lt;class ‘torch._dynamo.variables.constant.ConstantVariable’&gt;] False<br>
User Stack:<br>
&lt;FrameSummary file /home/ysna/optionTest/explainfn3_gb.py, line 7 in toy_example&gt;<br>
Break Reason 2:<br>
Reason: builtin: print [&lt;class ‘torch._dynamo.variables.tensor.TensorVariable’&gt;] False<br>
User Stack:<br>
&lt;FrameSummary file /home/ysna/optionTest/explainfn3_gb.py, line 8 in torch_dynamo_resume_in_toy_example_at_7&gt;<br>
Break Reason 3:<br>
Reason: generic_jump TensorVariable()<br>
User Stack:<br>
&lt;FrameSummary file /home/ysna/optionTest/explainfn3_gb.py, line 10 in torch_dynamo_resume_in_toy_example_at_9&gt;<br>
Break Reason 4:<br>
Reason: builtin: print [&lt;class ‘torch._dynamo.variables.constant.ConstantVariable’&gt;] False<br>
User Stack:<br>
&lt;FrameSummary file /home/ysna/optionTest/explainfn3_gb.py, line 12 in torch_dynamo_resume_in_toy_example_at_10&gt;<br>
Break Reason 5:<br>
Reason: builtin: print [&lt;class ‘torch._dynamo.variables.tensor.TensorVariable’&gt;] False<br>
User Stack:<br>
&lt;FrameSummary file /home/ysna/optionTest/explainfn3_gb.py, line 13 in torch_dynamo_resume_in_toy_example_at_12&gt;<br>
Break Reason 6:<br>
Reason: generic_jump TensorVariable()<br>
User Stack:<br>
&lt;FrameSummary file /home/ysna/optionTest/explainfn3_gb.py, line 14 in torch_dynamo_resume_in_toy_example_at_13&gt;<br>
Ops per Graph:<br>
Ops 1:<br>
&lt;built-in method abs of type object at 0x7f6e2a21df60&gt;<br>
<br>
<br>
Ops 2:<br>
Ops 3:<br>
<br>
Ops 4:<br>
<br>
Ops 5:<br>
<br>
Ops 6:<br>
<br>
Ops 7:<br>
<br>
Out Guards:<br>
Guard 1:<br>
Name: “G[‘torch’].abs”<br>
Source: global<br>
Create Function: FUNCTION_MATCH<br>
Guard Types: [‘ID_MATCH’]<br>
Code List: [“___check_obj_id(G[‘torch’].abs, 140111262463648)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a77e0; to ‘builtin_function_or_method’ at 0x7f6e320736a0&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6e327644a0; to ‘type’ at 0x93a400 (builtin_function_or_method)&gt;<br>
Guard 2:<br>
Name: “G[‘torch’]”<br>
Source: global<br>
Create Function: FUNCTION_MATCH<br>
Guard Types: [‘ID_MATCH’]<br>
Code List: [“___check_obj_id(G[‘torch’], 140111268245200)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7650; to ‘module’ at 0x7f6e325f6ed0&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6e32797010; to ‘type’ at 0x939ec0 (module)&gt;<br>
Guard 3:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DETERMINISTIC_ALGORITHMS<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 4:<br>
Name: “G[‘__builtins_dict___1’][‘print’]”<br>
Source: global<br>
Create Function: BUILTIN_MATCH<br>
Guard Types: [‘ID_MATCH’]<br>
Code List: [“___check_obj_id(G[‘__builtins_dict___1’][‘print’], 140111270235728)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7920; to ‘builtin_function_or_method’ at 0x7f6e327dce50&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6e327644a0; to ‘type’ at 0x93a400 (builtin_function_or_method)&gt;<br>
Guard 5:<br>
Name: ‘’<br>
Source: global<br>
Create Function: TORCH_FUNCTION_STATE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 6:<br>
Name: ‘’<br>
Source: shape_env<br>
Create Function: SHAPE_ENV<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 7:<br>
Name: “L[‘a’]”<br>
Source: local<br>
Create Function: TENSOR_MATCH<br>
Guard Types: [‘TENSOR_MATCH’]<br>
Code List: [“hasattr(L[‘a’], ‘_dynamo_dynamic_indices’) == False”]<br>
Object Weakref: &lt;weakref at 0x7f6cc07c1490; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 8:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DEFAULT_DEVICE<br>
Guard Types: [‘DEFAULT_DEVICE’]<br>
Code List: [‘utils_device.CURRENT_DEVICE == None’]<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 9:<br>
Name: ‘’<br>
Source: global<br>
Create Function: GRAD_MODE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 10:<br>
Name: “L[‘b’].sum”<br>
Source: local<br>
Create Function: HASATTR<br>
Guard Types: [‘HASATTR’]<br>
Code List: [“hasattr(L[‘b’], ‘sum’)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7dd0; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 11:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DETERMINISTIC_ALGORITHMS<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 12:<br>
Name: “G[‘__builtins_dict___5’][‘print’]”<br>
Source: global<br>
Create Function: BUILTIN_MATCH<br>
Guard Types: [‘ID_MATCH’]<br>
Code List: [“___check_obj_id(G[‘__builtins_dict___5’][‘print’], 140111270235728)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7920; to ‘builtin_function_or_method’ at 0x7f6e327dce50&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6e327644a0; to ‘type’ at 0x93a400 (builtin_function_or_method)&gt;<br>
Guard 13:<br>
Name: ‘’<br>
Source: global<br>
Create Function: TORCH_FUNCTION_STATE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 14:<br>
Name: ‘’<br>
Source: shape_env<br>
Create Function: SHAPE_ENV<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 15:<br>
Name: “L[‘b’]”<br>
Source: local<br>
Create Function: TENSOR_MATCH<br>
Guard Types: [‘TENSOR_MATCH’]<br>
Code List: [“hasattr(L[‘b’], ‘_dynamo_dynamic_indices’) == False”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7dd0; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 16:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DEFAULT_DEVICE<br>
Guard Types: [‘DEFAULT_DEVICE’]<br>
Code List: [‘utils_device.CURRENT_DEVICE == None’]<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 17:<br>
Name: ‘’<br>
Source: global<br>
Create Function: GRAD_MODE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 18:<br>
Name: “L[‘b’].sum”<br>
Source: local<br>
Create Function: HASATTR<br>
Guard Types: [‘HASATTR’]<br>
Code List: [“hasattr(L[‘b’], ‘sum’)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7dd0; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 19:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DETERMINISTIC_ALGORITHMS<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 20:<br>
Name: “L[‘b’]”<br>
Source: local<br>
Create Function: TENSOR_MATCH<br>
Guard Types: [‘TENSOR_MATCH’]<br>
Code List: [“hasattr(L[‘b’], ‘_dynamo_dynamic_indices’) == False”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7dd0; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 21:<br>
Name: ‘’<br>
Source: global<br>
Create Function: TORCH_FUNCTION_STATE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 22:<br>
Name: ‘’<br>
Source: shape_env<br>
Create Function: SHAPE_ENV<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 23:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DEFAULT_DEVICE<br>
Guard Types: [‘DEFAULT_DEVICE’]<br>
Code List: [‘utils_device.CURRENT_DEVICE == None’]<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 24:<br>
Name: ‘’<br>
Source: global<br>
Create Function: GRAD_MODE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 25:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DETERMINISTIC_ALGORITHMS<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 26:<br>
Name: “G[‘__builtins_dict___16’][‘print’]”<br>
Source: global<br>
Create Function: BUILTIN_MATCH<br>
Guard Types: [‘ID_MATCH’]<br>
Code List: [“___check_obj_id(G[‘__builtins_dict___16’][‘print’], 140111270235728)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7920; to ‘builtin_function_or_method’ at 0x7f6e327dce50&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6e327644a0; to ‘type’ at 0x93a400 (builtin_function_or_method)&gt;<br>
Guard 27:<br>
Name: ‘’<br>
Source: global<br>
Create Function: TORCH_FUNCTION_STATE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 28:<br>
Name: ‘’<br>
Source: shape_env<br>
Create Function: SHAPE_ENV<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 29:<br>
Name: “L[‘b’]”<br>
Source: local<br>
Create Function: TENSOR_MATCH<br>
Guard Types: [‘TENSOR_MATCH’]<br>
Code List: [“hasattr(L[‘b’], ‘_dynamo_dynamic_indices’) == False”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7dd0; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 30:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DEFAULT_DEVICE<br>
Guard Types: [‘DEFAULT_DEVICE’]<br>
Code List: [‘utils_device.CURRENT_DEVICE == None’]<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 31:<br>
Name: ‘’<br>
Source: global<br>
Create Function: GRAD_MODE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 32:<br>
Name: “L[‘b’].sum”<br>
Source: local<br>
Create Function: HASATTR<br>
Guard Types: [‘HASATTR’]<br>
Code List: [“hasattr(L[‘b’], ‘sum’)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc0634720; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 33:<br>
Name: “L[‘b’]”<br>
Source: local<br>
Create Function: TENSOR_MATCH<br>
Guard Types: [‘TENSOR_MATCH’]<br>
Code List: [“hasattr(L[‘b’], ‘_dynamo_dynamic_indices’) == False”]<br>
Object Weakref: &lt;weakref at 0x7f6cc0634720; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 34:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DETERMINISTIC_ALGORITHMS<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 35:<br>
Name: ‘’<br>
Source: global<br>
Create Function: TORCH_FUNCTION_STATE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 36:<br>
Name: ‘’<br>
Source: shape_env<br>
Create Function: SHAPE_ENV<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 37:<br>
Name: “G[‘__builtins_dict___20’][‘print’]”<br>
Source: global<br>
Create Function: BUILTIN_MATCH<br>
Guard Types: [‘ID_MATCH’]<br>
Code List: [“___check_obj_id(G[‘__builtins_dict___20’][‘print’], 140111270235728)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc06a7920; to ‘builtin_function_or_method’ at 0x7f6e327dce50&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6e327644a0; to ‘type’ at 0x93a400 (builtin_function_or_method)&gt;<br>
Guard 38:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DEFAULT_DEVICE<br>
Guard Types: [‘DEFAULT_DEVICE’]<br>
Code List: [‘utils_device.CURRENT_DEVICE == None’]<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 39:<br>
Name: ‘’<br>
Source: global<br>
Create Function: GRAD_MODE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 40:<br>
Name: “L[‘b’].sum”<br>
Source: local<br>
Create Function: HASATTR<br>
Guard Types: [‘HASATTR’]<br>
Code List: [“hasattr(L[‘b’], ‘sum’)”]<br>
Object Weakref: &lt;weakref at 0x7f6cc0634720; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 41:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DETERMINISTIC_ALGORITHMS<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 42:<br>
Name: ‘’<br>
Source: global<br>
Create Function: TORCH_FUNCTION_STATE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 43:<br>
Name: ‘’<br>
Source: shape_env<br>
Create Function: SHAPE_ENV<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 44:<br>
Name: “L[‘b’]”<br>
Source: local<br>
Create Function: TENSOR_MATCH<br>
Guard Types: [‘TENSOR_MATCH’]<br>
Code List: [“hasattr(L[‘b’], ‘_dynamo_dynamic_indices’) == False”]<br>
Object Weakref: &lt;weakref at 0x7f6cc0634720; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 45:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DEFAULT_DEVICE<br>
Guard Types: [‘DEFAULT_DEVICE’]<br>
Code List: [‘utils_device.CURRENT_DEVICE == None’]<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 46:<br>
Name: ‘’<br>
Source: global<br>
Create Function: GRAD_MODE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 47:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DETERMINISTIC_ALGORITHMS<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 48:<br>
Name: ‘’<br>
Source: global<br>
Create Function: TORCH_FUNCTION_STATE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 49:<br>
Name: ‘’<br>
Source: shape_env<br>
Create Function: SHAPE_ENV<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 50:<br>
Name: “L[‘x’]”<br>
Source: local<br>
Create Function: TENSOR_MATCH<br>
Guard Types: [‘TENSOR_MATCH’]<br>
Code List: [“hasattr(L[‘x’], ‘_dynamo_dynamic_indices’) == False”]<br>
Object Weakref: &lt;weakref at 0x7f6cc0536930; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 51:<br>
Name: “L[‘b’]”<br>
Source: local<br>
Create Function: TENSOR_MATCH<br>
Guard Types: [‘TENSOR_MATCH’]<br>
Code List: [“hasattr(L[‘b’], ‘_dynamo_dynamic_indices’) == False”]<br>
Object Weakref: &lt;weakref at 0x7f6cc0634720; dead&gt;<br>
Guarded Class Weakref: &lt;weakref at 0x7f6da7b404a0; to ‘torch._C._TensorMeta’ at 0x311c9e20 (Tensor)&gt;<br>
Guard 52:<br>
Name: ‘’<br>
Source: global<br>
Create Function: DEFAULT_DEVICE<br>
Guard Types: [‘DEFAULT_DEVICE’]<br>
Code List: [‘utils_device.CURRENT_DEVICE == None’]<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Guard 53:<br>
Name: ‘’<br>
Source: global<br>
Create Function: GRAD_MODE<br>
Guard Types: None<br>
Code List: None<br>
Object Weakref: None<br>
Guarded Class Weakref: None<br>
Compile Times: TorchDynamo compilation metrics:<br>
Function, Runtimes (s)<br>
_compile.compile_inner, 0.4575, 0.0140, 0.0086, 0.0990, 0.0139, 0.0140, 0.0152, 0.0084, 0.0059<br>
OutputGraph.call_user_compiler, 0.0002, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001</p>