Public Attributes | |
enabled | |
use_cuda | |
function_events | |
entered | |
Context manager that manages autograd profiler state and holds a summary of results. Arguments: enabled (bool, optional): Setting this to False makes this context manager a no-op. Default: ``True``. use_cuda (bool, optional): Enables timing of CUDA events as well using the cudaEvent API. Adds approximately 4us of overhead to each tensor operation. Default: ``False`` .. warning: This context managers should not be called recursively, i.e. at most one instance should be enabled at any given time. Example: >>> x = torch.randn((1, 1), requires_grad=True) >>> with torch.autograd.profiler.profile() as prof: ... y = x ** 2 ... y.backward() >>> # NOTE: some columns were removed for brevity ... print(prof) ------------------------------------- --------------- --------------- Name CPU time CUDA time ------------------------------------- --------------- --------------- PowConstant 142.036us 0.000us N5torch8autograd9GraphRootE 63.524us 0.000us PowConstantBackward 184.228us 0.000us MulConstant 50.288us 0.000us PowConstant 28.439us 0.000us Mul 20.154us 0.000us N5torch8autograd14AccumulateGradE 13.790us 0.000us N5torch8autograd5CloneE 4.088us 0.000us
Definition at line 129 of file profiler.py.