diff --git a/src/finn/core/modelwrapper.py b/src/finn/core/modelwrapper.py index 11a5a26a2d0c430b66c9d40d4fe42cdb6ed93460..84e89dd319724bc52e6978acedfcec1b7e1cf564 100644 --- a/src/finn/core/modelwrapper.py +++ b/src/finn/core/modelwrapper.py @@ -130,3 +130,16 @@ class ModelWrapper: for t in graph.initializer: execution_context[t.name] = np_helper.to_array(t) return execution_context + + def check_all_tensor_shapes_specified(self): + """Checks whether all tensors have a specified shape (ValueInfo). + The ONNX standard allows for intermediate activations to have no + associated ValueInfo, but FINN expects this.""" + graph = self._model_proto.graph + ret = True + for n in graph.node: + for i in n.input: + ret = ret and (self.get_tensor_shape(i) is not None) + for o in n.output: + ret = ret and (self.get_tensor_shape(o) is not None) + return ret