From 452ba703699657ab3719fd38be42b6719b0cf960 Mon Sep 17 00:00:00 2001 From: Jeremy Johnson Date: Mon, 23 Oct 2023 16:56:46 +0100 Subject: 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 Change-Id: I97dc2254f0b58c05c39cc0281a331a394c2a4b3c --- reference_model/src/ops/data_nodes.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'reference_model/src/ops') 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(); } -- cgit v1.2.1