Skip to content

Conversation

@MrSidims
Copy link
Owner

@MrSidims MrSidims commented May 7, 2025

With the output type a user can specify their own way to print IR in the code and this output will be respected by the tool. Example use case: import torch
import torch.nn as nn
from torch_mlir import fx
from torch_mlir.compiler_utils import run_pipeline_with_repro_report from torch_mlir.fx import OutputType

class MyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)

    def forward(self, x):
        return torch.relu(self.linear(x))

model = MyModel()
example_input = torch.randn(4, 4)
module = fx.export_and_import(model, example_input, output_type=OutputType.LINALG_ON_TENSORS) print(module)

This patch also brings few modifications to README.

With the output type a user can specify their own way to print IR in the code
and this output will be respected by the tool. Example use case:
import torch
import torch.nn as nn
from torch_mlir import fx
from torch_mlir.compiler_utils import run_pipeline_with_repro_report
from torch_mlir.fx import OutputType

class MyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)

    def forward(self, x):
        return torch.relu(self.linear(x))

model = MyModel()
example_input = torch.randn(4, 4)
module = fx.export_and_import(model, example_input, output_type=OutputType.LINALG_ON_TENSORS)
print(module)

This patch also brings few modifications to README.
@MrSidims MrSidims merged commit 550d2dc into main May 7, 2025
1 check passed
@MrSidims MrSidims deleted the add-pytorch-raw-output branch May 7, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants