aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/ops
diff options
context:
space:
mode:
authorJeremy Johnson <jeremy.johnson@arm.com>2023-10-23 16:56:46 +0100
committerEric Kunze <eric.kunze@arm.com>2023-10-24 21:22:43 +0000
commit452ba703699657ab3719fd38be42b6719b0cf960 (patch)
tree298686b2cd5a00c8185779d90b4ab8951acf4d1c /reference_model/src/ops
parent29e46cfdbcdf87e9ef7fc4be8cdda64d2d88a6cc (diff)
downloadreference_model-452ba703699657ab3719fd38be42b6719b0cf960.tar.gz
Catch when CONSTs aren't initialized
CONST data should be either data in the flatbuffer file or loaded in via an input file. This check catches if neither of these have been done, instead of marking uninitialized data as valid. Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com> Change-Id: I97dc2254f0b58c05c39cc0281a331a394c2a4b3c
Diffstat (limited to 'reference_model/src/ops')
-rw-r--r--reference_model/src/ops/data_nodes.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/reference_model/src/ops/data_nodes.cc b/reference_model/src/ops/data_nodes.cc
index 07e7e97..705981c 100644
--- a/reference_model/src/ops/data_nodes.cc
+++ b/reference_model/src/ops/data_nodes.cc
@@ -38,6 +38,16 @@ int OpConst::checkTensorAttributes()
int OpConst::eval()
{
+ for (auto ct : getOutputs())
+ {
+ if (!ct->getIsValid())
+ {
+ std::string err = "Constant tensor " + ct->getName() + " not correctly initialized";
+ printNodeValidationError(err.c_str());
+ return 1;
+ }
+ }
+
// Evaluation is trivial for constants
return GraphNode::eval();
}