Skip to content

Commit

Permalink
Merge pull request #49775 from geetachavan1/cherrypicks_SHF4T
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 199763a + aed3651 commit abebb8a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tensorflow/lite/kernels/embedding_lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ TfLiteStatus EvalSimple(TfLiteContext* context, TfLiteNode* node,
const TfLiteTensor* lookup, const TfLiteTensor* value,
TfLiteTensor* output) {
const int row_size = SizeOfDimension(value, 0);
if (row_size == 0) {
// Propagate empty tensor if input is empty
return kTfLiteOk;
}
const int row_bytes = value->bytes / row_size;

char* output_raw = GetTensorData<char>(output);
Expand Down

0 comments on commit abebb8a

Please sign in to comment.