[Mlir-commits] [mlir] [mlir][tensor] Add a tensor.concat operation (PR #72779)

Han-Chung Wang llvmlistbot at llvm.org
Mon Nov 27 15:18:36 PST 2023


================
@@ -471,6 +471,202 @@ void CastOp::getCanonicalizationPatterns(RewritePatternSet &results,
   results.add<ChainedTensorCast, TensorCastExtractSlice>(context);
 }
 
+//===----------------------------------------------------------------------===//
+// ConcatOp
+//===----------------------------------------------------------------------===//
+
+FailureOr<RankedTensorType> ConcatOp::inferResultType(int64_t dim,
+                                                      TypeRange inputTypes) {
+  if (dim < 0)
+    return failure();
----------------
hanhanW wrote:

+1. I think we can move the checks to verifier and make this method return `RankedTensorType` type. Like other static methods, user should be careful when they use the util. It is okay to not return a failure in this static method. Adding assertions is good enough to me.

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


More information about the Mlir-commits mailing list