TFLite: Enhance input check for ResizeNearestNeghbor
PiperOrigin-RevId: 239440642
This commit is contained in:
parent
41dac366fb
commit
bf686faedd
@ -57,11 +57,13 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
|
|||||||
const TfLiteTensor* size = GetInput(context, node, kSizeTensor);
|
const TfLiteTensor* size = GetInput(context, node, kSizeTensor);
|
||||||
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
|
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
|
||||||
|
|
||||||
// TODO(ahentz): Our current implementations rely on the inputs being 4D.
|
// TODO(ahentz): Our current implementations rely on the input being 4D,
|
||||||
|
// and the size being 1D tensor with exactly 2 elements.
|
||||||
TF_LITE_ENSURE_EQ(context, NumDimensions(input), 4);
|
TF_LITE_ENSURE_EQ(context, NumDimensions(input), 4);
|
||||||
TF_LITE_ENSURE_EQ(context, NumDimensions(size), 1);
|
TF_LITE_ENSURE_EQ(context, NumDimensions(size), 1);
|
||||||
|
|
||||||
TF_LITE_ENSURE_EQ(context, size->type, kTfLiteInt32);
|
TF_LITE_ENSURE_EQ(context, size->type, kTfLiteInt32);
|
||||||
|
TF_LITE_ENSURE_EQ(context, size->dims->data[0], 2);
|
||||||
|
|
||||||
output->type = input->type;
|
output->type = input->type;
|
||||||
|
|
||||||
if (!IsConstantTensor(size)) {
|
if (!IsConstantTensor(size)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user