aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/kernels/batchtospace_op.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/kernels/batchtospace_op.cc')
-rw-r--r--tensorflow/core/kernels/batchtospace_op.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/core/kernels/batchtospace_op.cc b/tensorflow/core/kernels/batchtospace_op.cc
index b24a834083..99b5d3daaa 100644
--- a/tensorflow/core/kernels/batchtospace_op.cc
+++ b/tensorflow/core/kernels/batchtospace_op.cc
@@ -97,6 +97,10 @@ static void BatchToSpaceOpCompute(OpKernelContext* context,
for (int block_dim = 0; block_dim < block_dims; ++block_dim) {
block_shape_product *= block_shape[block_dim];
}
+ OP_REQUIRES(
+ context, block_shape_product > 0,
+ errors::InvalidArgument("Product of block sizes must be positive, got ",
+ block_shape_product));
const int64 orig_input_batch_size = orig_input_tensor.dim_size(0);
OP_REQUIRES(