apple / apple/coremltools

EnumeratedShapes converts with ClassifierConfig

Open
#2,764 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

## 🐞Describing the bug
Apparently, ClassifierConfig only supports batch size of 1, and the conversion will fail if you supply any other batch explicitly. However, is not the case with EnumeratedShapes - the converter passes just fine, but you will get an error when trying to run the model on a mac device.
I'd appreciate if the conversion script failed whenever the single-sample (B=1) native models encounter symbolic shapes.

## Stack Trace
```
input shape spec: EnumeratedShapes([(1, 32, 32, 3), (4, 32, 32, 3), (8, 32, 32, 3)], default=[4, 32, 32, 3])
Converting PyTorch Frontend ==> MIL Ops: 98%|█████████▊| 41/42 [00:00<00:00, 1658.45 ops/s]
Running MIL frontend_pytorch pipeline: 0%| | 0/5 [00:00

Contributor guide

Open the contributing guide

Research direction

Start with the linked Colab reproduction and trace how EnumeratedShapes and ClassifierConfig are handled during conversion. Compare the behavior for batch size 1 and larger batches, then identify the conversion path for symbolic shapes. Done means unsupported native models fail during conversion rather than later on a Mac device, while supported inputs retain their current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.