aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/toco/tooling_util.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-05-04 12:28:42 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-04 13:38:13 -0700
commit5ca373b4b64167f8b0fcab96d7d2e7886ea31b6a (patch)
treef82cba06cb52c035f834f8fb8c5daa9bee3ed9bb /tensorflow/contrib/lite/toco/tooling_util.cc
parentbe9b87375adecad9bd8bb12c81b2566c77a68ad7 (diff)
Some fixes to support another TF graph:
1. Fix ResolveBatchNormalization to avoid deleting arrays that may still be used. 2. Correctly count the number of ops using a given array, even when some ops use the same array as more than one of their inputs. 3. In PropagateFixedSizes for Concatenation ops, when resolving a -1 wildcard to a fixed value, we were doing so in a local 'axis' variable without actually updating op->axis! The resulting -1 value still in op->axis tripped runtime code, causing the concatenation to misbehave during inference. PiperOrigin-RevId: 195454037
Diffstat (limited to 'tensorflow/contrib/lite/toco/tooling_util.cc')
-rw-r--r--tensorflow/contrib/lite/toco/tooling_util.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/toco/tooling_util.cc b/tensorflow/contrib/lite/toco/tooling_util.cc
index 86ee1f3761..341d45e753 100644
--- a/tensorflow/contrib/lite/toco/tooling_util.cc
+++ b/tensorflow/contrib/lite/toco/tooling_util.cc
@@ -143,6 +143,10 @@ int CountOpsWithInput(const Model& model, const string& array_name) {
for (auto& input : op->inputs) {
if (input == array_name) {
count++;
+ // Breaking here is important: some graphs have ops that use the
+ // same array as more than one of their inputs, and in that case
+ // we want it counted only once.
+ break;
}
}
}