apple / apple/coremltools

Output name ignored when converting from milinternal

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

Description

```python
import coremltools as cmt
from coremltools.converters.mil.mil import Builder as mb

@mb.program(input_specs=[mb.TensorSpec(shape=(10,))])
def prog(x):
return mb.slice_by_index(x=x, begin=[5], end=[7])

model = cmt.convert(
prog,
source="milinternal",
outputs=[cmt.TensorType(name="y")] # This is ignored
)

print(model)
```

Prints:
```
input {
name: "x"
type {
multiArrayType {
shape: 10
dataType: FLOAT32
}
}
}
output {
name: "slice_by_index_0"
type {
multiArrayType {
dataType: FLOAT32
}
}
}
metadata {
userDefined {
key: "com.github.apple.coremltools.source"
value: "milinternal"
}
userDefined {
key: "com.github.apple.coremltools.version"
value: "6.0"
}
}
```
The single output name of `model` is `slice_by_index_0`. It should be `y`.

Contributor guide

Open the contributing guide

Research direction

Start by running the provided Python example and tracing the cmt.convert entry point for source="milinternal", focusing on how outputs is handled. Done means the converted model's single output is named "y" and a regression test covers this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.