Add input layer to profiling plots (fixes #404)#1439
Open
siddiquifaras wants to merge 1 commit intofastmachinelearning:mainfrom
Open
Add input layer to profiling plots (fixes #404)#1439siddiquifaras wants to merge 1 commit intofastmachinelearning:mainfrom
siddiquifaras wants to merge 1 commit intofastmachinelearning:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #404 by including input layer distribution and precision overlay in profiling plots.
Problem: Profiling plots showed all layers except the input. The
activations_keras,activations_torch, andactivations_hlsmodelfunctions all skipped input data, andactivation_types_hlsmodelhad no input tick label to anchor the type overlay to.Solution: Added two private helper functions (
_normalize_input_dataand_add_input_distributions) and updated four existing functions to prepend input distributions before processing layer activations. The type overlay now explicitly includes input variable precisions frommodel.get_input_variables().Dependencies: None - uses existing numpy operations and follows the same vectorized pattern as existing layer processing.
Type of change
Implementation Details
New helpers
Updated functions
activations_keras: Prepends input distribution by collectingInputLayernamesactivations_torch: Prepends input distribution before converting X to tensoractivations_hlsmodel: Prepends input distribution and handles multi-input X formats (ndarray/list/dict) for traceactivation_types_hlsmodel: Explicitly adds input variable precisions with O(1) duplicate checkingWhy the ordering works
boxplot(fmt='summary')callsdata.reverse()before plotting. Input entries are prepended first, so after reversal they appear at the top (highest y-position). Type overlay matches by layer name, so both the distribution tick and precision rectangle align automatically.Tests
New tests (
test/pytest/test_profiling_input_layer.py):_normalize_input_datahelper (single input, multi-input list, multi-input dict)activations_keras(summary and longform formats)activation_types_hlsmodel(presence and valid precision bounds)Test execution:
Test Configuration:
-p no:randomlyto avoid unrelated qonnx seed issuesChecklist
pre-commiton the files I edited or added.Additional Notes