-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhance] Make the parameters of get_model_complexity_info() friendly #1056
Conversation
Signed-off-by: Shengjiang QUAN <qsj287068067@126.com>
mmengine/analysis/print_helper.py
Outdated
assert (input_shape is not None) or ( | ||
inputs | ||
is not None), '"input_shape" and "inputs" cannot both be "None".' | ||
if (input_shape is not None) and (inputs is not None): | ||
warnings.warn('Both "input_shape" and "inputs" are provided.\ | ||
"inputs" will be used.') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directly throwing errors are OK when they are both set.
When "input_shape" and "inputs" are both `None` or both set, throw ValueError. Signed-off-by: Shengjiang QUAN <qsj287068067@126.com>
## Motivation `inputs` and `input_shape` can't be both set to mmengine api `get_model_complexity_info` open-mmlab/mmengine#1056 ## Modification Set `input_shape` to None.
## Motivation `inputs` and `input_shape` can't be both set to mmengine api `get_model_complexity_info` open-mmlab/mmengine#1056 ## Modification Set `input_shape` to None.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1056 +/- ##
=======================================
Coverage ? 76.39%
=======================================
Files ? 139
Lines ? 11194
Branches ? 2251
=======================================
Hits ? 8552
Misses ? 2280
Partials ? 362
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Motivation
Optimize the flexibility of function
get_model_complexity_info()
. #1055Modification
input_shape
toNone
.assert
does not allow bothinput_shape
andinputs
areNone
.input_shape
andinputs
are provided, print a warning.BC-breaking (Optional)
It the downstream repo calls the function
get_model_complexity_info()
like this line (It seems that the downstream repos have to call this function like the linked line.), not change has to be performed on the existing repos to fit this modification.Use cases (Optional)
Not applicable.
Checklist