Skip to content

Commit 8aba885

Browse files
authored
Document Exceptions in profilers (#6229)
* docstring changes in profilers * minor changes in profilers.py
1 parent ce05687 commit 8aba885

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pytorch_lightning/profiler/profilers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ def __init__(self, output_filename: Optional[str] = None, extended=True):
133133
Args:
134134
output_filename: optionally save profile results to file instead of printing
135135
to std out when training is finished.
136+
137+
Raises:
138+
ValueError:
139+
If you attempt to start an action which has already started, or
140+
if you attempt to stop recording an action which was never started.
136141
"""
137142
self.current_actions = {}
138143
self.recorded_durations = defaultdict(list)
@@ -234,6 +239,10 @@ def __init__(self, output_filename: Optional[str] = None, line_count_restriction
234239
line_count_restriction: this can be used to limit the number of functions
235240
reported for each action. either an integer (to select a count of lines),
236241
or a decimal fraction between 0.0 and 1.0 inclusive (to select a percentage of lines)
242+
243+
Raises:
244+
ValueError:
245+
If you attempt to stop recording an action which was never started.
237246
"""
238247
self.profiled_actions = {}
239248
self.line_count_restriction = line_count_restriction
@@ -376,6 +385,13 @@ def __init__(
376385
377386
local_rank: When running in distributed setting, local_rank is used for each process
378387
to write to their own file if `output_fname` is provided.
388+
389+
Raises:
390+
MisconfigurationException:
391+
If arg ``sort_by_key`` is not present in ``AVAILABLE_SORT_KEYS``, or
392+
if log file is not a ``.txt`` file.
393+
ValueError:
394+
If you attempt to stop recording an action which was never started.
379395
"""
380396

381397
self.profiled_actions = {}

0 commit comments

Comments
 (0)