Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gramalingam committed Oct 11, 2024
1 parent f816280 commit 18862b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions onnxscript/optimizer/_constant_folding.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def is_constant_op(node: ir.Node) -> bool:
# use ORT's implementation if we want to.


def _process_constant_node(node: ir.node) -> None:
def _process_constant_node(node: ir.Node) -> None:
"""Sets const_value of output value of a Constant op node."""
if node.op_type != "Constant" or node.domain not in {"", "ai.onnx"}:
return
Expand Down Expand Up @@ -660,7 +660,7 @@ def process_node(self, node: ir.Node):
logger.debug(
"Node [%s]: Replacing input %s with %s",
node.name,
value.name,
value.name, # type: ignore[union-attr]
sym_value.name,
)
node.replace_input_with(i, sym_value)
Expand Down
3 changes: 2 additions & 1 deletion onnxscript/rewriter/_ir_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import onnxscript.ir as ir
from onnxscript.optimizer import basic_constant_propagation


def get_const_value(value: ir.Value) -> ir.TensorProtocol | None:
node = value.producer()
if node is not None:
basic_constant_propagation([node])
return value.const_value
return value.const_value

0 comments on commit 18862b9

Please sign in to comment.