From f43f6ff22bc1960d9d8f1f0fb422a23b8e052eb0 Mon Sep 17 00:00:00 2001 From: Tom Solberg Date: Tue, 3 Mar 2026 08:15:08 +0100 Subject: [PATCH] use logging instead of print --- onnxscript/rewriter/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onnxscript/rewriter/__init__.py b/onnxscript/rewriter/__init__.py index fb93bc703f..52806d621d 100644 --- a/onnxscript/rewriter/__init__.py +++ b/onnxscript/rewriter/__init__.py @@ -2,6 +2,7 @@ # Licensed under the MIT License. from __future__ import annotations +import logging from typing import Sequence, TypeVar, Union __all__ = [ @@ -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? @@ -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) + return ir.passes.PassResult(model, bool(count))