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

Allow rewriter input/output to be IR #1639

Merged
merged 5 commits into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions onnxscript/rewriter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License.
from __future__ import annotations

from typing import Sequence, Union, TypeVar
from typing import Sequence, TypeVar, Union

__all__ = [
# Modules
Expand All @@ -22,7 +22,8 @@
PatternRewriteRule = pattern.RewriteRule
FunctionRewriteRule = function_rule.FunctionRewriteRule

ModelProtoOrIr = TypeVar('ModelProtoOrIr', onnx.ModelProto, ir.Model)
ModelProtoOrIr = TypeVar("ModelProtoOrIr", onnx.ModelProto, ir.Model)


def rewrite(
model: ModelProtoOrIr,
Expand Down Expand Up @@ -51,4 +52,4 @@
if proto:
model = ir.serde.serialize_model(model_ir)
return model
return model_ir
return model_ir # type: ignore[return-value]

Check warning on line 55 in onnxscript/rewriter/__init__.py

View check run for this annotation

Codecov / codecov/patch

onnxscript/rewriter/__init__.py#L55

Added line #L55 was not covered by tests
Loading