# 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 | |
python fix_batch_dimension.py "$model" "${model%.onnx}_batch1.onnx" --batch_size 1 | |
echo "Generated ${model%.onnx}_batch1.onnx" | |
# Process for batch size 2 | |
python fix_batch_dimension.py "$model" "${model%.onnx}_batch2.onnx" --batch_size 2 | |
echo "Generated ${model%.onnx}_batch2.onnx" | |
# Process for batch size 4 | |
python fix_batch_dimension.py "$model" "${model%.onnx}_batch4.onnx" --batch_size 4 | |
echo "Generated ${model%.onnx}_batch4.onnx" | |
fi | |
done | |