Skip to content

Commit 3e6970d

Browse files
committed
Merge branch 'ci/sync_gh_tflite-micro' into 'master'
Sync esp-tflite-micro from github - 1097358 See merge request app-frameworks/esp-tflite-micro!178
2 parents 1171b51 + 1d4932c commit 3e6970d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tensorflow/lite/micro/kernels/prelu.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,18 @@ TfLiteStatus PreluEval(TfLiteContext* context, TfLiteNode* node) {
6161
tflite::micro::GetTensorData<int8_t>(output));
6262
return kTfLiteOk;
6363
} break;
64+
case kTfLiteInt16: {
65+
reference_ops::BroadcastPrelu4DSlow(
66+
params, tflite::micro::GetTensorShape(input),
67+
tflite::micro::GetTensorData<int16_t>(input),
68+
tflite::micro::GetTensorShape(alpha),
69+
tflite::micro::GetTensorData<int8_t>(alpha),
70+
tflite::micro::GetTensorShape(output),
71+
tflite::micro::GetTensorData<int16_t>(output));
72+
return kTfLiteOk;
73+
} break;
6474
default:
65-
MicroPrintf("Only float32 and uint8_t are supported currently, got %d.",
75+
MicroPrintf("Input type '%s' is not supported.",
6676
TfLiteTypeGetName(input->type));
6777
return kTfLiteError;
6878
}

tensorflow/lite/micro/kernels/prelu_common.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ TfLiteStatus PreluPrepare(TfLiteContext* context, TfLiteNode* node) {
9696
TF_LITE_ENSURE_OK(context,
9797
CalculatePreluParams(input, alpha, output, params));
9898

99+
if (output->type == kTfLiteInt16) {
100+
// Make sure alpha type is Int8 when Output is Int16
101+
TF_LITE_ENSURE(context, alpha->type == kTfLiteInt8);
102+
}
103+
99104
micro_context->DeallocateTempTfLiteTensor(input);
100105
micro_context->DeallocateTempTfLiteTensor(alpha);
101106
micro_context->DeallocateTempTfLiteTensor(output);

0 commit comments

Comments
 (0)