[Mlir-commits] [mlir] [mlir][sparse] Enable explicit and implicit value in sparse encoding (PR #88975)

Maksim Levental llvmlistbot at llvm.org
Wed Apr 17 15:50:59 PDT 2024


================
@@ -18,10 +18,11 @@ def testEncodingAttr1D():
             "#sparse_tensor.encoding<{"
             "  map = (d0) -> (d0 : compressed),"
             "  posWidth = 16,"
-            "  crdWidth = 32"
+            "  crdWidth = 32,"
+            "  explicitVal = 1.0 : f64"
----------------
makslevental wrote:

just btw you can write this more easily with something like this

```python
    with Context() as ctx:
        parsed = Attribute.parse(
            textwrap.dedent("""\
              #sparse_tensor.encoding<{
                map = (d0) -> (d0 : compressed),
                posWidth = 16,
                crdWidth = 32,
                explicitVal = 1.0 : f64
            }>\
            """
            )
        )
```

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


More information about the Mlir-commits mailing list