Shortcuts

AdvancedProfiler

class lightning.pytorch.profilers.AdvancedProfiler(dirpath=None, filename=None, line_count_restriction=1.0)[소스]

기반 클래스: lightning.pytorch.profilers.profiler.Profiler

This profiler uses Python’s cProfiler to record more detailed information about time spent in each function call recorded during a given action.

The output is quite verbose and you should only use this if you want very detailed reports.

매개변수
  • dirpath (Union[str, Path, None]) – Directory path for the filename. If dirpath is None but filename is present, the trainer.log_dir (from TensorBoardLogger) will be used.

  • filename (Optional[str]) – If present, filename where the profiler results will be saved instead of printing to stdout. The .txt extension will be used automatically.

  • line_count_restriction (float) – this can be used to limit the number of functions reported for each action. either an integer (to select a count of lines), or a decimal fraction between 0.0 and 1.0 inclusive (to select a percentage of lines)

예외 발생

ValueError – If you attempt to stop recording an action which was never started.

start(action_name)[소스]

Defines how to start recording an action.

반환 형식

None

stop(action_name)[소스]

Defines how to record the duration once an action is complete.

반환 형식

None

teardown(stage)[소스]

Execute arbitrary post-profiling tear-down steps.

Closes the currently open file and stream.

반환 형식

None