Skip to content

[TORCH] Add support for aten.hinge_embedding_loss #4222

@sharavak

Description

@sharavak
Contributor

I would like to add support for the torch.hinge_embedding_loss operation in the Torch dialect of Torch-MLIR.

I tested with the torch.hinge_embedding_loss using fx.export_and_import and the reproduced error is

Image

Minimal Reproduction

import torch
import torch.nn as nn
from torch_mlir import fx

def run(f):
    print(f"{f.__name__}")
    print("-" * len(f.__name__))
    f()
    print()

@run
def test_hinge_embedding_loss():
    class HingeEmbeddingLossModule(nn.Module):
        def __init__(self):
            super().__init__()
        def forward(self,x):
            input,target=x
            return torch.hinge_embedding_loss(input,target)
    
    exported=fx.export_and_import(HingeEmbeddingLossModule(),(torch.randn(5,3),torch.randn(1)),output_type='torch')
    print(exported)

Activity

sharavak

sharavak commented on Jun 4, 2025

@sharavak
ContributorAuthor

@vivekkhandelwal1 I would like to take this up and implement it.

vivekkhandelwal1

vivekkhandelwal1 commented on Jun 9, 2025

@vivekkhandelwal1
Collaborator

@vivekkhandelwal1 I would like to take this up and implement it.

Hi @sharavak, I have assigned this issue to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @vivekkhandelwal1@sharavak

    Issue actions

      [TORCH] Add support for aten.hinge_embedding_loss · Issue #4222 · llvm/torch-mlir