| 383 | } |
| 384 | |
| 385 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { |
| 386 | const TfLiteTensor* input = GetInput(context, node, kInputTensor); |
| 387 | const TfLiteTensor* fft_length = GetInput(context, node, kFftLengthTensor); |
| 388 | const int32_t* fft_length_data = GetTensorData<int32_t>(fft_length); |
| 389 | TfLiteTensor* output = GetOutput(context, node, kOutputTensor); |
| 390 | |
| 391 | if (output->type != kTfLiteComplex64) { |
| 392 | context->ReportError(context, |
| 393 | "Type '%s' for output is not supported by rfft2d.", |
| 394 | TfLiteTypeGetName(output->type)); |
| 395 | return kTfLiteError; |
| 396 | } |
| 397 | |
| 398 | // Resize the output tensor if the fft_length tensor is not constant. |
| 399 | // Otherwise, check if the output shape is correct. |
| 400 | if (!IsConstantTensor(fft_length)) { |
| 401 | TF_LITE_ENSURE_STATUS(ResizeOutputandTemporaryTensors(context, node)); |
| 402 | } else { |
| 403 | int num_dims_output = NumDimensions(output); |
| 404 | const RuntimeShape output_shape = GetTensorShape(output); |
| 405 | TF_LITE_ENSURE_EQ(context, num_dims_output, NumDimensions(input)); |
| 406 | TF_LITE_ENSURE(context, num_dims_output >= 2); |
| 407 | TF_LITE_ENSURE_EQ(context, output_shape.Dims(num_dims_output - 2), |
| 408 | fft_length_data[0]); |
| 409 | TF_LITE_ENSURE_EQ(context, output_shape.Dims(num_dims_output - 1), |
| 410 | fft_length_data[1] / 2 + 1); |
| 411 | } |
| 412 | |
| 413 | return Rfft2dHelper(context, node); |
| 414 | } |
| 415 | |
| 416 | } // namespace rfft2d |
| 417 |
nothing calls this directly
no test coverage detected