Skip to content

Commit

Permalink
Merge pull request #49781 from geetachavan1/cherrypicks_V4G18
Browse files Browse the repository at this point in the history
Prevent division by 0
  • Loading branch information
mihaimaruseac committed May 30, 2021
2 parents d41015b + 3e1f82c commit 0792334
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tensorflow/lite/kernels/space_to_batch_nd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ TfLiteStatus ResizeOutputTensor(TfLiteContext* context,
for (int dim = 0; dim < kSpatialDimensionNum; ++dim) {
int final_dim_size = (input_size->data[dim + 1] + paddings_data[dim * 2] +
paddings_data[dim * 2 + 1]);
TF_LITE_ENSURE(context, block_shape[dim] != 0);
TF_LITE_ENSURE_EQ(context, final_dim_size % block_shape[dim], 0);
output_size->data[dim + 1] = final_dim_size / block_shape[dim];
}
Expand Down

0 comments on commit 0792334

Please sign in to comment.