apple / apple/coremltools

Support for torch.linalg.lstsq operation

Open
#2,084 7 comments 0 reactions 0 assignees View on GitHub
missing layer type PyTorch (traced)
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

## ❓Question about torch.linalg.lstsq Operation Support

### Summary
I am attempting to convert a PyTorch model that uses `torch.linalg.lstsq` to CoreML using `coremltools`, but it seems that this operation is not supported as well as other torch.linalg ops

### Issue Details
When I try to convert my model, I get an error stating that `torch.linalg` is unsupported. This is causing significant issues as there doesn't seem to be a straightforward workaround.

### Version
coremltools 7.1 [Latest](https://github.com/apple/coremltools/releases/latest)

### Code Sample
```
ref, residuals, rank, singular_values = torch.linalg.lstsq(
A_regul * weights_regul, b_regul * weights_regul)
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the conversion failure from the provided torch.linalg.lstsq example with coremltools 7.1, then trace the converter's handling of torch.linalg operations. Done means the example converts successfully and the supported operation is covered by conversion validation; no file or test location is identified in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.