aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/toco/graph_transformations/resolve_strided_slice_attributes.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-01-23 17:35:53 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-23 17:40:21 -0800
commit6dfe00ca4114371ed47c93810219736e3deda2d2 (patch)
tree14262ad0f7b3e212c0e2d84a480c383a4074031f /tensorflow/contrib/lite/toco/graph_transformations/resolve_strided_slice_attributes.cc
parenta3e81ec2892126056ad6c1feb9161bc16c2c2975 (diff)
Support StridedSlice in TFLite for 1D-4D tensors.
PiperOrigin-RevId: 183020501
Diffstat (limited to 'tensorflow/contrib/lite/toco/graph_transformations/resolve_strided_slice_attributes.cc')
-rw-r--r--tensorflow/contrib/lite/toco/graph_transformations/resolve_strided_slice_attributes.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/toco/graph_transformations/resolve_strided_slice_attributes.cc b/tensorflow/contrib/lite/toco/graph_transformations/resolve_strided_slice_attributes.cc
index de4d06be2a..7e8b249b07 100644
--- a/tensorflow/contrib/lite/toco/graph_transformations/resolve_strided_slice_attributes.cc
+++ b/tensorflow/contrib/lite/toco/graph_transformations/resolve_strided_slice_attributes.cc
@@ -33,6 +33,10 @@ bool ResolveStridedSliceAttributes::Run(Model* model, std::size_t op_index) {
CHECK_EQ(op->inputs.size(), 4);
const auto& start_array = model->GetArray(op->inputs[1]);
if (!start_array.has_shape()) return false;
+ if (toco::RequiredBufferSizeForShape(start_array.shape()) > 4) {
+ // Only 1-4D arrays are supported for now.
+ return false;
+ }
const auto& stop_array = model->GetArray(op->inputs[2]);
if (!stop_array.has_shape()) return false;