Skip to content

Commit

Permalink
Merge pull request #49082 from geetachavan1/cherrypicks_CZFN5
Browse files Browse the repository at this point in the history
Prevent division by 0
  • Loading branch information
mihaimaruseac committed May 11, 2021
2 parents ac67083 + 375b817 commit ad4f3e8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tensorflow/lite/kernels/batch_to_space_nd.cc
Expand Up @@ -78,6 +78,7 @@ TfLiteStatus ResizeOutputTensor(TfLiteContext* context,
int output_batch_size = input_size->data[0];
for (int dim = 0; dim < spatial_dims_num; ++dim) {
// Number of batch must be multiple of (block_shape[dim]).
TF_LITE_ENSURE(context, block_shape[dim] != 0);
TF_LITE_ENSURE_EQ(context, output_batch_size % block_shape[dim], 0);
output_batch_size = output_batch_size / block_shape[dim];
output_size->data[dim + 1] = input_size->data[dim + 1] * block_shape[dim] -
Expand Down

0 comments on commit ad4f3e8

Please sign in to comment.