[Mlir-commits] [mlir] [mlir][pybind] Support loading DenseElementsAttr of bools (PR #82868)

Rob Suderman llvmlistbot at llvm.org
Fri Feb 23 23:02:41 PST 2024


https://github.com/rsuderman created https://github.com/llvm/llvm-project/pull/82868

We were missing the python binding support for loading tensors of booleans from numpy arrays.

>From dba584884881de2ab88af479621367a9d7ef4a8a Mon Sep 17 00:00:00 2001
From: Rob Suderman <rob.suderman at gmail.com>
Date: Fri, 23 Feb 2024 23:01:53 -0800
Subject: [PATCH] [mlir][pybind] Support loading DenseElementsAttr of bools

We were missing the python binding support for loading tensors of
booleans from numpy arrays.
---
 mlir/lib/Bindings/Python/IRAttributes.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mlir/lib/Bindings/Python/IRAttributes.cpp b/mlir/lib/Bindings/Python/IRAttributes.cpp
index dda2003ba0375a..3bf305c1bbb3e9 100644
--- a/mlir/lib/Bindings/Python/IRAttributes.cpp
+++ b/mlir/lib/Bindings/Python/IRAttributes.cpp
@@ -694,6 +694,8 @@ class PyDenseElementsAttribute
         // f16
         assert(view.itemsize == 2 && "mismatched array itemsize");
         bulkLoadElementType = mlirF16TypeGet(context);
+      // } else if (format == "?") {
+      //     bulkLoadElementType = mlirIntegerTypeGet(context, 1);
       } else if (isSignedIntegerFormat(format)) {
         if (view.itemsize == 4) {
           // i32



More information about the Mlir-commits mailing list