aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-04-04 09:51:55 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-04 09:54:30 -0700
commit8badd11d875a826bd318ed439909d5c47a7fb811 (patch)
tree5894a8e81ab269878cf962b50407a93a1d8ee6b3 /tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc
parentcb8cdf261f932186d34bdd43b86e887eec450213 (diff)
Check arguments of ComputeConvSizes that should be positive.
PiperOrigin-RevId: 191604311
Diffstat (limited to 'tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc')
-rw-r--r--tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc b/tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc
index b96d698675..68d6f21cf8 100644
--- a/tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc
+++ b/tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc
@@ -38,6 +38,16 @@ void ComputeConvSizes(const Shape& input_shape, int output_depth, int kwidth,
const int input_height = input_shape.dims(1);
const int batch = input_shape.dims(0);
+ CHECK_GE(input_width, 1);
+ CHECK_GE(input_height, 1);
+ CHECK_GE(batch, 1);
+ CHECK_GE(kwidth, 1);
+ CHECK_GE(kheight, 1);
+ CHECK_GE(stride_width, 1);
+ CHECK_GE(stride_height, 1);
+ CHECK_GE(dilation_width_factor, 1);
+ CHECK_GE(dilation_height_factor, 1);
+
int dilated_kwidth = dilation_width_factor * (kwidth - 1) + 1;
int dilated_kheight = dilation_height_factor * (kheight - 1) + 1;