Skip to content

Commit 35bd419

Browse files
committed
[mlir] Add assert to fail with more info (NFC)
This would have assert before during tensor type construction with opaque error, assert and fail earlier now.
1 parent 1aa4f0b commit 35bd419

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mlir/lib/Interfaces/InferTypeOpInterface.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ LogicalResult mlir::detail::inferReturnTensorTypes(
191191
return failure();
192192
for (const auto &shapeAndType : retComponents) {
193193
assert(shapeAndType.getAttribute() == nullptr && "attribute not supported");
194+
assert(shapeAndType.getElementType() &&
195+
"element type required to construct tensor");
194196
if (shapeAndType.hasRank())
195197
inferredReturnTypes.push_back(RankedTensorType::get(
196198
shapeAndType.getDims(), shapeAndType.getElementType()));

0 commit comments

Comments
 (0)