aboutsummaryrefslogtreecommitdiff
path: root/src/TosaSerialize.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/TosaSerialize.cpp')
-rw-r--r--src/TosaSerialize.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/TosaSerialize.cpp b/src/TosaSerialize.cpp
index 21c0f93..625a922 100644
--- a/src/TosaSerialize.cpp
+++ b/src/TosaSerialize.cpp
@@ -1558,6 +1558,11 @@ TosaSerializationBlockBuilder::BuildTosaSerializationTensor(
mlir::RankedTensorType tensor =
val.getType().dyn_cast<mlir::RankedTensorType>();
+ if (!tensor) {
+ llvm::errs() << "TOSA serialization, attempt to build an "
+ "non-RankedTensorType Tensor\n";
+ return nullptr;
+ }
std::vector<int32_t> shape(tensor.getShape().begin(),
tensor.getShape().end());
DType type = Type2DType(tensor.getElementType());