read_tensorboard_profile

read_tensorboard_profile(logdir, *, session=None, top=DEFAULT_TOP, charts=None)

Read a profiling session as its step-time graph and top operations.

Parameters

Name Type Description Default
logdir str or os.PathLike The directory TensorBoard would be started with. required
session str Which session, as :func:find_profiles names it. By default the latest. None
top int How many operation types the second chart shows. 10
charts iterable of str Only these of "step_time" and "top_operations"; the profile is converted only for the tables they need. By default both. None

Returns

Name Type Description
list of TensorBoardChart The step-time graph, tagged profile/step_time, then the top operations, tagged profile/top_operations; either is left out when the profile holds no data for it. Their runs name the session.

Raises

Name Type Description
FileNotFoundError If logdir holds no profile, or no session of that name.
ValueError If charts names a chart other than those above.
ImportError If xprof is not installed.

Examples

>>> import maidr
>>> step_time, top_ops = maidr.read_tensorboard_profile("logs/fit")
>>> maidr.show(step_time)