Skip to content
Open
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
6 changes: 5 additions & 1 deletion onnxscript/rewriter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT License.
from __future__ import annotations

import logging
from typing import Sequence, TypeVar, Union

__all__ = [
Expand Down Expand Up @@ -48,6 +49,8 @@
_remove_optional_bias,
)

logger = logging.getLogger(__name__)

_ModelProtoOrIr = TypeVar("_ModelProtoOrIr", onnx.ModelProto, ir.Model)
_DEFAULT_REWRITE_RULES: tuple[pattern.RewriteRule, ...] = (
*_no_op.rules, # TODO: merge this rule into constant folding?
Expand Down Expand Up @@ -82,7 +85,8 @@ def __init__(
def call(self, model: ir.Model) -> ir.passes.PassResult:
count = self.rules.apply_to_model(model)
if count:
print(f"Applied {count} of general pattern rewrite rules.")
logger.info("Applied %s of general pattern rewrite rules.", count)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a config to display this by default? Could you do that?


return ir.passes.PassResult(model, bool(count))


Expand Down