[Mlir-commits] [mlir] 2fe7524 - [mlir][sparse][taco] Avoid hard-coding DimLevelType values.

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 3 10:03:06 PDT 2022


Author: bixia1
Date: 2022-10-03T10:02:57-07:00
New Revision: 2fe75248ea0e46d7d5b3075609d2ec112cff171e

URL: https://github.com/llvm/llvm-project/commit/2fe75248ea0e46d7d5b3075609d2ec112cff171e
DIFF: https://github.com/llvm/llvm-project/commit/2fe75248ea0e46d7d5b3075609d2ec112cff171e.diff

LOG: [mlir][sparse][taco] Avoid hard-coding DimLevelType values.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D135034

Added: 
    

Modified: 
    mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py

Removed: 
    


################################################################################
diff  --git a/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py b/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
index 6f82016a40c53..18dccffda672a 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
+++ b/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
@@ -353,7 +353,7 @@ def rank(self) -> int:
   def get_permutation_and_sparsity(self) -> Tuple[np.ndarray, np.ndarray]:
     """Constructs the numpy arrays for the permutation and sparsity."""
     perm = np.array(self.ordering.ordering, dtype=np.ulonglong)
-    a = [0 if s == ModeFormat.DENSE else 1 for s in self.format_pack.formats]
+    a = [f.value for f in self.format_pack.formats]
     sparse = np.array(a, dtype=np.uint8)
     return (perm, sparse)
 


        


More information about the Mlir-commits mailing list