graph LR
CLI_Interface["CLI Interface"]
Model_Instrumentation["Model Instrumentation"]
Metric_Calculation_Engine["Metric Calculation Engine"]
Statistics_Aggregation_Orchestration["Statistics Aggregation & Orchestration"]
Statistical_Data_Management["Statistical Data Management"]
Report_Generation_Formatting["Report Generation & Formatting"]
CLI_Interface -- "Initiates Analysis" --> Statistics_Aggregation_Orchestration
Statistics_Aggregation_Orchestration -- "Requests Model Hooking" --> Model_Instrumentation
Model_Instrumentation -- "Provides Layer Metadata" --> Statistics_Aggregation_Orchestration
Statistics_Aggregation_Orchestration -- "Dispatches Metric Calculations" --> Metric_Calculation_Engine
Metric_Calculation_Engine -- "Returns Calculated Metrics" --> Statistics_Aggregation_Orchestration
Statistics_Aggregation_Orchestration -- "Stores Layer Statistics" --> Statistical_Data_Management
Statistical_Data_Management -- "Provides Aggregated Statistics" --> Statistics_Aggregation_Orchestration
Statistics_Aggregation_Orchestration -- "Requests Report Generation" --> Report_Generation_Formatting
Report_Generation_Formatting -- "Displays Formatted Report" --> CLI_Interface
click Model_Instrumentation href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/torchstat/Model_Instrumentation.md" "Details"
click Statistics_Aggregation_Orchestration href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/torchstat/Statistics_Aggregation_Orchestration.md" "Details"
click Report_Generation_Formatting href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/torchstat/Report_Generation_Formatting.md" "Details"
The torchstat architecture is designed as a modular pipeline for comprehensive neural network analysis. It begins with the CLI Interface handling user input and initiating the analysis flow. The central Statistics Aggregation & Orchestration component then takes charge, first leveraging the Model Instrumentation to extract detailed layer-wise information from the target PyTorch model. This information is subsequently fed to the Metric Calculation Engine, which computes various performance metrics like FLOPs, memory usage, and MADDs. All collected and calculated statistics are meticulously organized and managed by the Statistical Data Management component. Finally, the aggregated data is passed to the Report Generation & Formatting component, which transforms it into a clear, human-readable report for display back to the user via the CLI Interface. This pipeline ensures a clear separation of concerns, enabling extensibility for new metrics and reporting formats, making it ideal for visual representation as a sequential data processing flow.
Serves as the primary user entry point, responsible for parsing command-line arguments, configuring the analysis, and initiating the overall process. It also acts as the final display medium for the generated reports.
Related Classes/Methods:
Model Instrumentation [Expand]
Dynamically hooks into a PyTorch model's forward pass to capture essential layer-specific metadata, such as input/output tensor shapes and module types. This information is crucial for subsequent metric calculations.
Related Classes/Methods:
A modular collection of specialized functions designed to compute various performance metrics (FLOPs, Memory, MADDs) for different types of neural network layers. This component acts as a pluggable engine, allowing for extensible analytical capabilities.
Related Classes/Methods:
Statistics Aggregation & Orchestration [Expand]
The central control module of the analysis pipeline. It orchestrates the entire process by coordinating model instrumentation, dispatching calls to the Metric Calculation Engine, aggregating the results from various calculations, and preparing the consolidated data for reporting.
Related Classes/Methods:
Manages a hierarchical data structure (StatTree) that efficiently stores, organizes, and allows for granular updates of the collected statistics for each module and submodule within the neural network.
Related Classes/Methods:
Report Generation & Formatting [Expand]
Takes the aggregated statistical data from the Statistics Aggregation & Orchestration component and formats it into a human-readable report, typically presented in a tabular or structured text format suitable for display to the user.
Related Classes/Methods: