[Mlir-commits] [mlir] [mlir][python] Add bindings for mlirDenseElementsAttrGet (PR #91389)

Maksim Levental llvmlistbot at llvm.org
Tue May 21 13:36:36 PDT 2024


================
@@ -647,6 +664,55 @@ class PyDenseElementsAttribute
   static constexpr const char *pyClassName = "DenseElementsAttr";
   using PyConcreteAttribute::PyConcreteAttribute;
 
+  static PyDenseElementsAttribute
+  getFromList(py::list attributes, std::optional<PyType> explicitType,
+              DefaultingPyMlirContext contextWrapper) {
+
+    if (py::len(attributes) == 0) {
----------------
makslevental wrote:

nit: can do something like `size_t numAttributes = py::len(attributes);` so you don't need to call in multiple places.

https://github.com/llvm/llvm-project/pull/91389


More information about the Mlir-commits mailing list