Profiler — PyTorch Lightning 2.5.1.post0 documentation (original) (raw)
class lightning.pytorch.profilers.Profiler(dirpath=None, filename=None)[source]¶
Bases: ABC
If you wish to write a custom profiler, you should inherit from this class.
Logs a profile report after the conclusion of run.
Return type:
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:
abstract start(action_name)[source]¶
Defines how to start recording an action.
Return type:
abstract stop(action_name)[source]¶
Defines how to record the duration once an action is complete.
Return type:
Execute arbitrary post-profiling tear-down steps.
Closes the currently open file and stream.
Return type: