CoreML segfaults on torch.nn.Conv1d
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 850
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 10
Description
## 🐞Describing the bug
CoreML segfaults when running torch.ops.aten.conv1d.default.
## To Reproduce
```
import torch
class Model(torch.nn.Module):
def __init__(self):
super().__init__()
self.conv = torch.nn.Conv1d(16, 4, 6, stride=8, padding=0, dilation=2, groups=2, bias=False)
def forward(self, x):
return self.conv(x)
model = Model()
inputs = (
torch.randn(2, 16, 11),
)
eager_outputs = model(*inputs)
ep = torch.export.export(model, inputs)
import coremltools as ct
import numpy as np
ep = ep.run_decompositions({})
eager_outputs = model(*inputs)
mlmodel = ct.convert(ep)
coreml_inputs = mlmodel.get_spec().description.input
coreml_outputs = mlmodel.get_spec().description.output
predict_inputs = {str(ct_in.name): pt_in.detach().cpu().numpy().astype(np.int32) for ct_in, pt_in in zip(coreml_inputs, inputs)}
out = mlmodel.predict(predict_inputs)
print("Eager", eager_outputs)
print("CoremL", out)
```
This above code results in a segfault.
## System environment (please complete the following information):
- coremltools version: 8.3
- OS (e.g. MacOS version or Linux type): macOS15
Contributor guide
Research direction
Start by running the provided Python reproduction through torch.ops.aten.conv1d.default, torch.export.export, and ct.convert on macOS 15 with coremltools 8.3. Trace the failure around CoreML conversion and prediction; done means the Conv1d model converts and predicts without a segmentation fault.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python, pytorch
- Domain
- devtools, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100