diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-06-13 08:45:19 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-06-13 08:47:58 -0700 |
commit | f0e053afc99c8dcf6aa196b00dafaee0a7f6923f (patch) | |
tree | a95ebde03f7e7aa6b77300e9bda3793477b8e0a0 /tensorflow/contrib/lite/toco/tooling_util.cc | |
parent | bb6532ae227b1f5ce72fbf3bd009f078698324de (diff) |
Fix for DumpGraphviz() failing on zero-sized arrays, which it should handle for debugging purposes.
PiperOrigin-RevId: 200397151
Diffstat (limited to 'tensorflow/contrib/lite/toco/tooling_util.cc')
-rw-r--r-- | tensorflow/contrib/lite/toco/tooling_util.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/toco/tooling_util.cc b/tensorflow/contrib/lite/toco/tooling_util.cc index 5cb4caab3f..92bab5246c 100644 --- a/tensorflow/contrib/lite/toco/tooling_util.cc +++ b/tensorflow/contrib/lite/toco/tooling_util.cc @@ -585,6 +585,13 @@ void UnextendShape(Shape* shape, int new_shape_size) { shape_dims.erase(shape_dims.begin(), shape_dims.begin() + size_reduction); } +bool IsValid(const Shape& shape) { + for (int i = 0; i < shape.dimensions_count(); ++i) { + if (shape.dims(i) < 1) return false; + } + return true; +} + void CheckShapeDimensions(const Shape& shape) { for (int i = 0; i < shape.dimensions_count(); ++i) { CHECK_GE(shape.dims()[i], 1) << "shape has dimension 0 at index << " << i |