[Mlir-commits] [mlir] 10ec0d2 - [MLIR] fix _f64ElementsAttr in ir.py (#91176)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon May 6 05:08:50 PDT 2024


Author: Yuanqiang Liu
Date: 2024-05-06T20:08:47+08:00
New Revision: 10ec0d20892c170182a50129614675d3173a3f44

URL: https://github.com/llvm/llvm-project/commit/10ec0d20892c170182a50129614675d3173a3f44
DIFF: https://github.com/llvm/llvm-project/commit/10ec0d20892c170182a50129614675d3173a3f44.diff

LOG: [MLIR] fix _f64ElementsAttr in ir.py (#91176)

Added: 
    

Modified: 
    mlir/python/mlir/ir.py
    mlir/test/python/dialects/python_test.py

Removed: 
    


################################################################################
diff  --git a/mlir/python/mlir/ir.py b/mlir/python/mlir/ir.py
index eb7f035fec7c1f..80c965b2d0eb2c 100644
--- a/mlir/python/mlir/ir.py
+++ b/mlir/python/mlir/ir.py
@@ -274,7 +274,7 @@ def _memref_type_attr(x, context):
     @register_attribute_builder("F64ElementsAttr")
     def _f64ElementsAttr(x, context):
         return DenseElementsAttr.get(
-            np.array(x, dtype=np.int64),
+            np.array(x, dtype=np.float64),
             type=F64Type.get(context=context),
             context=context,
         )

diff  --git a/mlir/test/python/dialects/python_test.py b/mlir/test/python/dialects/python_test.py
index 88761c9d08fe07..70927b22d4749c 100644
--- a/mlir/test/python/dialects/python_test.py
+++ b/mlir/test/python/dialects/python_test.py
@@ -167,7 +167,7 @@ def attrBuilder():
             x_f32arr=[2.0, 3.0],
             x_f64=4.25,  # CHECK-DAG: x_f64 = 4.250000e+00 : f64
             x_f64arr=[4.0, 8.0],  # CHECK-DAG: x_f64arr = [4.000000e+00, 8.000000e+00]
-            # CHECK-DAG: x_f64elems = dense<[3.952530e-323, 7.905050e-323]> : tensor<2xf64>
+            # CHECK-DAG: x_f64elems = dense<[8.000000e+00, 1.600000e+01]> : tensor<2xf64>
             x_f64elems=[8.0, 16.0],
             # CHECK-DAG: x_flatsymrefarr = [@symbol1, @symbol2]
             x_flatsymrefarr=["symbol1", "symbol2"],


        


More information about the Mlir-commits mailing list