message: Refactor SoftmaxQuantized (for HiFi mini) so we have a nice error message when the output type is wrong.
diff: @@ -71,21 +71,29 @@ TfLiteStatus CalculateSoftmaxOpData(TfLiteContext* context,
  return kTfLiteOk;
  }
  -} // namespace
  -
  -void SoftmaxQuantized(const TfLiteTensor* input, TfLiteTensor* output,
  +TfLiteStatus SoftmaxQuantized(TfLiteContext* context, const TfLiteTensor* input,
  + TfLiteTensor* output,
  const SoftmaxParams& op_params) {
  - if (output->type == kTfLiteInt16) {
  + switch (output->type) {
  + case kTfLiteInt16:
  tflite::reference_ops::Softmax(
  op_params, GetTensorShape(input), GetTensorData<int8_t>(input),
  GetTensorShape(output), GetTensorData<int16_t>(output));
  - } else {
  + return kTfLiteOk;
  + case kTfLiteInt8:
  tflite::reference_ops::Softmax(
  op_params, GetTensorShape(input), GetTensorData<int8_t>(input),
  GetTensorShape(output), GetTensorData<int8_t>(output));
  + return kTfLiteOk;
  + default:
  + TF_LITE_KERNEL_LOG(context, "Type %s (%d) not supported.",
  + TfLiteTypeGetName(output->type), output->type);
  + return kTfLiteError;
  }
  }
  +} // namespace
  +
  TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) {
  auto* params = static_cast<TfLiteSoftmaxParams*>(node->builtin_data);
  @@ -113,10 +121,8 @@ TfLiteStatus SoftmaxEval(TfLiteContext* context, TfLiteNode* node) {
  TfLiteTensor* output = GetOutput(context, node, 0);
  switch (input->type) {
  - case kTfLiteInt8: {
  - SoftmaxQuantized(input, output, *op_params);
  - return kTfLiteOk;
  - }
  + case kTfLiteInt8:
  + return SoftmaxQuantized(context, input, output, *op_params);
  default:
  TF_LITE_KERNEL_LOG(context, "Type %s (%d) not supported.",
  TfLiteTypeGetName(input->type), input->type);
  