Skip to content

Commit

Permalink
[docs] Update make_dynamic_shape_fixed helper documentation to accoun…
Browse files Browse the repository at this point in the history
…t for CoreML supporting dynamic input shapes. (#22349)
  • Loading branch information
edgchen1 authored Oct 10, 2024
1 parent e85a37d commit 0392be8
Showing 1 changed file with 4 additions and 3 deletions.
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)

0 comments on commit 0392be8

Please sign in to comment.