From 4b1fa0ccdcada19035fe9e685f2b63a5c7a78f21 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 14 May 2018 07:53:04 -0700 Subject: [PATCH] Prevent removal of constant inputs to passthrough ops. PiperOrigin-RevId: 196505061 --- .../lite/toco/graph_transformations/remove_trivial_passthrough.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tensorflow/contrib/lite/toco/graph_transformations/remove_trivial_passthrough.cc b/tensorflow/contrib/lite/toco/graph_transformations/remove_trivial_passthrough.cc index 971e4ff..a950fe6 100644 --- a/tensorflow/contrib/lite/toco/graph_transformations/remove_trivial_passthrough.cc +++ b/tensorflow/contrib/lite/toco/graph_transformations/remove_trivial_passthrough.cc @@ -85,9 +85,11 @@ bool RemoveTrivialPassthroughOp(GraphTransformation* transformation, "Removing %s, keeping its non-constant input array %s and removing %s", LogName(*passthru_op), main_input_name, output_name); RerouteEdges(output_name, main_input_name, model); - } else if (IsDiscardableArray(*model, main_input_name)) { + } else if (IsDiscardableArray(*model, main_input_name) && + !IsConstantParameterArray(*model, main_input_name)) { transformation->AddMessageF( - "Removing %s, keeping its output array %s and removing input %s", + "Removing %s, keeping its output array %s and removing non-constant " + "input %s", LogName(*passthru_op), output_name, main_input_name); RerouteEdges(main_input_name, output_name, model); } else { -- 2.7.4