MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Eval

Function Eval

tensorflow/lite/kernels/rfft2d.cc:385–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385TfLiteStatus 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

Callers

nothing calls this directly

Calls 10

GetInputFunction · 0.85
GetOutputFunction · 0.85
TfLiteTypeGetNameFunction · 0.85
NumDimensionsFunction · 0.85
Rfft2dHelperFunction · 0.85
DimsMethod · 0.80
IsConstantTensorFunction · 0.70
GetTensorShapeFunction · 0.50
ReportErrorMethod · 0.45

Tested by

no test coverage detected