quantise: Don't error when initializer graph input is missing (#1872)

ONNX IR version 4 and above do not require graph initializers to have
corresponding graph inputs.
This commit is contained in:
Jonny Shipton 2019-09-30 22:57:00 +01:00 committed by Ashwini Khade
parent e361174f78
commit df472cbfbd

View file

@ -309,9 +309,10 @@ class ONNXQuantizer:
# Removing input weight to a convolution
try:
weight_input = next(val for val in self.model.graph.input if val.name == weight.name)
self.model.graph.input.remove(weight_input)
except StopIteration:
raise ValueError('invalid weight name {} found in the graph '.format(weight.name))
self.model.graph.input.remove(weight_input)
if self.model.ir_version < 4:
raise ValueError('invalid weight name {} found in the graph (not a graph input) '.format(weight.name))
def _update_graph(self, weight):