Profiler¶
- class pytorch_lightning.profilers.Profiler(dirpath=None, filename=None)[source]¶
Bases:
abc.ABC
If you wish to write a custom profiler, you should inherit from this class.
- profile(action_name)[source]¶
Yields a context manager to encapsulate the scope of a profiled action.
Example:
with self.profile('load training data'): # load training data code
The profiler will start once you’ve entered the context and will automatically stop once you exit the code block.
- Return type:
- setup(stage, local_rank=None, log_dir=None)[source]¶
Execute arbitrary pre-profiling set-up steps.
- Return type: