aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-10-09 07:54:16 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-09 07:59:00 -0700
commita0ed9452d5c7f897e26788d8dca5164cb6fba023 (patch)
tree1170139716513fa272fdf97184689b8f3a41020b /tensorflow
parenta9a44b070bf639ee9bd60f0fd21157a297cd7f82 (diff)
Fixing Toco for exporting graphs with strings
If the graph contains not constant array with strings it fails because the array's size can't be estimated. PiperOrigin-RevId: 216356162
Diffstat (limited to 'tensorflow')
-rw-r--r--tensorflow/contrib/lite/toco/tooling_util.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/tensorflow/contrib/lite/toco/tooling_util.cc b/tensorflow/contrib/lite/toco/tooling_util.cc
index e3f27e9e2a..083a96ad9d 100644
--- a/tensorflow/contrib/lite/toco/tooling_util.cc
+++ b/tensorflow/contrib/lite/toco/tooling_util.cc
@@ -1237,11 +1237,15 @@ void DedupeConstantArrays(Model* model, size_t min_size) {
lhs_array.final_data_type != ArrayDataType::kNone
? lhs_array.final_data_type
: lhs_array.data_type;
- size_t array_byte_size =
- lhs_array.buffer->Length() * ElementSize(final_data_type);
- if (array_byte_size < min_size) {
- // Too small; skip.
- continue;
+ // Ignore small arrays, don't check string arrays because it is not possible
+ // to estimate its size.
+ if (final_data_type != ArrayDataType::kString) {
+ size_t array_byte_size =
+ lhs_array.buffer->Length() * ElementSize(final_data_type);
+ if (array_byte_size < min_size) {
+ // Too small; skip.
+ continue;
+ }
}
auto next_lhs_array_it = lhs_array_it;