Skip to content
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

[docs] Update make_dynamic_shape_fixed helper documentation to account for CoreML supporting dynamic input shapes. #22349

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/tutorials/mobile/helpers/make-dynamic-shape-fixed.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ nav_order: 2
# Making dynamic input shapes fixed
{: .no_toc }

If a model can potentially be used with NNAPI or CoreML as reported by the [model usability checker](./model-usability-checker.md), it may require the input shapes to be made 'fixed'. This is because NNAPI and CoreML do not support dynamic input shapes.
If a model can potentially be used with NNAPI or CoreML as reported by the [model usability checker](./model-usability-checker.md), it may benefit from making the input shapes 'fixed'.
This is because NNAPI does not support dynamic input shapes and CoreML may have better performance with fixed input shapes.

For example, often models have a dynamic batch size so that training is more efficient. In mobile scenarios the batch generally has a size of 1. Making the batch size dimension 'fixed' by setting it to 1 may allow NNAPI and CoreML to run of the model.
For example, often models have a dynamic batch size so that training is more efficient. In mobile scenarios the batch generally has a size of 1.
Making the batch size dimension 'fixed' by setting it to 1 may allow NNAPI to run the model.

The helper can be used to update specific dimensions, or the entire input shape.

Expand Down Expand Up @@ -83,4 +85,3 @@ python -m onnxruntime.tools.make_dynamic_shape_fixed --input_name x --input_shap
After replacement you should see that the shape for 'x' is now 'fixed' with a value of [1, 3, 960, 960]

![Updated model with dynamic input shape now having fixed values](../../../../images/model-with-dynamic-inputs-fixed.png)

Loading