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

Function Prepare

tensorflow/lite/kernels/mfcc.cc:64–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
65 auto* params = reinterpret_cast<TfLiteMfccParams*>(node->user_data);
66
67 TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
68 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
69
70 const TfLiteTensor* input_wav = GetInput(context, node, kInputTensorWav);
71 const TfLiteTensor* input_rate = GetInput(context, node, kInputTensorRate);
72 TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
73
74 TF_LITE_ENSURE_EQ(context, NumDimensions(input_wav), 3);
75 TF_LITE_ENSURE_EQ(context, NumElements(input_rate), 1);
76
77 TF_LITE_ENSURE_EQ(context, output->type, kTfLiteFloat32);
78 TF_LITE_ENSURE_EQ(context, input_wav->type, output->type);
79 TF_LITE_ENSURE_EQ(context, input_rate->type, kTfLiteInt32);
80
81 TfLiteIntArray* output_size = TfLiteIntArrayCreate(3);
82 output_size->data[0] = input_wav->dims->data[0];
83 output_size->data[1] = input_wav->dims->data[1];
84 output_size->data[2] = params->dct_coefficient_count;
85
86 return context->ResizeTensor(context, output, output_size);
87}
88
89// Input is a single squared-magnitude spectrogram frame. The input spectrum
90// is converted to linear magnitude and weighted into bands using a

Callers

nothing calls this directly

Calls 8

NumInputsFunction · 0.85
GetInputFunction · 0.85
GetOutputFunction · 0.85
NumDimensionsFunction · 0.85
TfLiteIntArrayCreateFunction · 0.85
ResizeTensorMethod · 0.80
NumOutputsFunction · 0.70
NumElementsFunction · 0.70

Tested by

no test coverage detected