Skip to content
Permalink
Browse files Browse the repository at this point in the history
Prevent division by 0
PiperOrigin-RevId: 370966645
Change-Id: I831bfd96c7eb77b02d7ebb744335f59f6e5728cb
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Apr 28, 2021
1 parent e4b2980 commit f61c57b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tensorflow/lite/kernels/embedding_lookup.cc
Expand Up @@ -71,6 +71,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 f61c57b

Please sign in to comment.