Skip to navigation

aitune.torch.jit.html_generator

View as Markdown

HTML generation module for InspectModule visualization.

Module Contents

Classes

NameDescription
HTMLGeneratorHTML generator for InspectModule hierarchy visualization.

API

class aitune.torch.jit.html_generator.HTMLGenerator()

HTML generator for InspectModule hierarchy visualization.

aitune.torch.jit.html_generator.HTMLGenerator._calculate_module_stats(
) -> tuple[int, str]
staticmethod

Calculate module statistics including total count and parameters.

Parameters:

inspect_module_class
type[InspectModule]

The InspectModule class to calculate stats for.

Returns: tuple[int, str]

Tuple of (total_module_count, total_parameters_string).

aitune.torch.jit.html_generator.HTMLGenerator._calculate_self_time(
) -> float
staticmethod

Calculate self time for a module.

Self time is the total execution time minus the sum of all children’s execution times.

Parameters:

module
InspectModule

The module to calculate self time for.

Returns: float

Self time in seconds.

aitune.torch.jit.html_generator.HTMLGenerator._generate_module_tree_html(
) -> str
staticmethod

Generate HTML for the module tree structure.

Parameters:

inspect_module_class
type[InspectModule]

The InspectModule class to generate HTML for.

Returns: str

HTML string representing the module hierarchy.

aitune.torch.jit.html_generator.HTMLGenerator._get_css_styles() -> str
staticmethod

Get CSS styles for the HTML page.

Returns: str

CSS styles as a string.

aitune.torch.jit.html_generator.HTMLGenerator._get_javascript() -> str
staticmethod

Get JavaScript for interactive functionality.

Returns: str

JavaScript code as a string.

aitune.torch.jit.html_generator.HTMLGenerator._traverse_modules(
)
staticmethod

Generator that traverses all modules in the hierarchy.

Parameters:

inspect_module_class
type[InspectModule]

The InspectModule class to traverse.

aitune.torch.jit.html_generator.HTMLGenerator.generate_html_content(
inspect_module_class: type[aitune.torch.jit.inspect_module.InspectModule],
model_name: str = 'Model'
) -> str
staticmethod

Generate comprehensive HTML content for module hierarchy visualization.

Parameters:

inspect_module_class
type[InspectModule]

The InspectModule class to generate HTML for.

model_name
strDefaults to 'Model'

The name of the model to display in the subtitle.

Returns: str

Complete HTML document as a string with CSS and JavaScript.