Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyTorch convert function for op 'l1_loss' not implemented #2331

Open
hex41434 opened this issue Sep 3, 2024 · 1 comment
Open

PyTorch convert function for op 'l1_loss' not implemented #2331

hex41434 opened this issue Sep 3, 2024 · 1 comment
Labels
feature request Functionality does not currently exist, would need to be created as a new feature (type)

Comments

@hex41434
Copy link

hex41434 commented Sep 3, 2024

Hi,

I encountered an error while attempting to convert a PyTorch model to Core ML using the CoreMLTools convert function. The model utilizes the l1_loss operation, and during the conversion process, I received the following error:

RuntimeError: PyTorch convert function for op 'l1_loss' not implemented.

Request:

I am requesting either:

  • Implementation support for the l1_loss operation in the CoreMLTools conversion process, or
  • Guidance on recommended practices or alternative methods for handling l1_loss during model conversion.

Thank you for your attention to this issue!

@hex41434 hex41434 added the feature request Functionality does not currently exist, would need to be created as a new feature (type) label Sep 3, 2024
@YifanShenSZ
Copy link
Collaborator

Hi @hex41434, could you please elaborate your use case a bit? Concretely, why would a loss function present in inference?

As a temporary workaround, you may explicitly decompose your torch.nn.L1Loss layer with torch.mean(torch.abs(y - x))

The long term solution will be to add an op translation. Here is an example for Frobenius norm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Functionality does not currently exist, would need to be created as a new feature (type)
Projects
None yet
Development

No branches or pull requests

2 participants