[Mlir-commits] [mlir] [mlir][python] python binding for the affine.store op (PR #68816)
Maksim Levental
llvmlistbot at llvm.org
Wed Oct 11 09:28:45 PDT 2023
================
@@ -0,0 +1,54 @@
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+try:
+ from ..ir import *
+ from ._ods_common import get_op_result_or_value as _get_op_result_or_value
+ from ._ods_common import get_op_results_or_values as _get_op_results_or_values
+except ImportError as e:
+ raise RuntimeError("Error loading imports from extension module") from e
+
+from typing import Optional, Sequence, Union
+
+
+class AffineStoreOp:
+ """Specialization for the Affine store operation."""
+
+ def __init__(
+ self,
+ value: Value,
+ memref: Union[Operation, OpView, Value],
+ map,
+ *,
+ map_operands=[],
----------------
makslevental wrote:
This is one of those [python gotchas](https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments) that actually exists in other places in our code base. Can you make this `=None` and then add something like `map = map if map is not None else []` (not necessarily that concise - typing on my phone...).
https://github.com/llvm/llvm-project/pull/68816
More information about the Mlir-commits
mailing list