Added exception handling in case of unsuccessful model saving.
@@ -207,7 +207,12 @@ class eval_classifier_optimized_graph:
f = gfile.GFile(path, 'wb')
f.write(model.as_graph_def().SerializeToString())
+ try:
save(q_model, evaluate_opt_graph.args.output_graph)
+ except AttributeError as no_model:
+ print("None of the quantized models fits the accuracy criteria: {0}".format(no_model))
+ except Exception as exc:
+ print("Unexpected error while saving the model: {0}".format(exc))
if self.args.benchmark:
infer_graph = tf.Graph()
