File size: 898 Bytes
c4f84a9 e4e03fd c4f84a9 e4e03fd c4f84a9 e4e03fd c4f84a9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#!/bin/bash
# Loop through all .onnx files in the current directory
for model in ./*.onnx; do
# Exclude processing any files that already have a batch size in their name
if [[ ! $model =~ _batch[0-9]+\.onnx$ ]]; then
# Process for batch size 1
python3 -m onnxruntime.tools.make_dynamic_shape_fixed --dim_param batch --dim_value 1 "$model" "${model%.onnx}_batch1.onnx"
echo "Generated ${model%.onnx}_batch1.onnx"
# Process for batch size 2
python3 -m onnxruntime.tools.make_dynamic_shape_fixed --dim_param batch --dim_value 2 "$model" "${model%.onnx}_batch2.onnx"
echo "Generated ${model%.onnx}_batch2.onnx"
# Process for batch size 4
python3 -m onnxruntime.tools.make_dynamic_shape_fixed --dim_param batch --dim_value 4 "$model" "${model%.onnx}_batch4.onnx"
echo "Generated ${model%.onnx}_batch4.onnx"
fi
done
|