Skip to content

Commit b8c7ecc

Browse files
ddavis-2015veblush
andauthored
Return error on wrong tensor type for CAST (#3248)
@tensorflow/micro Return kTfLiteError when unsupported input/output tensor type is used in CAST kernel. bug=fixes #3241 Co-authored-by: Esun Kim <veblush@google.com>
1 parent 62cbc8e commit b8c7ecc

File tree

1 file changed

+2
-0
lines changed
  • tensorflow/lite/micro/kernels

1 file changed

+2
-0
lines changed

tensorflow/lite/micro/kernels/cast.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ TfLiteStatus copyToTensor(TfLiteContext* context, const FromT* in,
7373
// Unsupported type.
7474
MicroPrintf("Output type %s (%d) not supported.",
7575
TfLiteTypeGetName(out->type), out->type);
76+
return kTfLiteError;
7677
}
7778
return kTfLiteOk;
7879
}
@@ -108,6 +109,7 @@ TfLiteStatus CastEval(TfLiteContext* context, TfLiteNode* node) {
108109
// Unsupported type.
109110
MicroPrintf("Input type %s (%d) not supported.",
110111
TfLiteTypeGetName(input->type), input->type);
112+
return kTfLiteError;
111113
}
112114
return kTfLiteOk;
113115
}

0 commit comments

Comments
 (0)