Skip to content

[TORCH] Add support for aten.hinge_embedding_loss #4222

Open
@sharavak

Description

@sharavak

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions