Skip to content
Permalink
Browse files Browse the repository at this point in the history
Handle one more division by 0 in TFLite.
PiperOrigin-RevId: 370800140
Change-Id: I9ab42e5aaccf02f226d1282611490a54cf7d273e
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Apr 28, 2021
1 parent 0d45ea1 commit 8e45822
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tensorflow/lite/kernels/gather_nd.cc
Expand Up @@ -155,6 +155,9 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_OK(context,
GetOutputSafe(context, node, kOutputTensor, &output));

// Prevent division by 0 in the helper
TF_LITE_ENSURE(context, NumElements(params) > 0);

switch (indices->type) {
case kTfLiteInt32:
return EvalGatherNd<int32_t>(context, params, indices, output);
Expand Down

0 comments on commit 8e45822

Please sign in to comment.