PyTorch Profiler self cpu time vs cpu time

Hi, I’m looking for explanation for this sentence “Note the difference between self cpu time and cpu time - operators can call other operators, self cpu time excludes time spent in children operator calls, while total cpu time includes it.” in in this topic: PyTorch Profiler — PyTorch Tutorials 2.5.0+cu124 documentation

What is the children operators calls inside that layer? and how can I see them?

1 Like

Functions can call into other functions (or operators) as seen in the example profile:

#                   model_inference       5.509ms      57.503ms      57.503ms             1
#                      aten::conv2d     231.000us      31.931ms       1.597ms            20
#                 aten::convolution     250.000us      31.700ms       1.585ms            20
#                aten::_convolution     336.000us      31.450ms       1.573ms            20
#          aten::mkldnn_convolution      30.838ms      31.114ms       1.556ms            20

Here model_inference calls into aten::conv2d which calls into aten::convolution, which …
The time spent in model_inference in total (including all calls into all operators) is 57ms while the time spent in the model_inference body (without following any other calls) is only 5.5ms.