MCPcopy Create free account
hub / github.com/DamRsn/NeuralNote / computeFeatures

Method computeFeatures

Lib/Model/Features.cpp:19–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19const float* Features::computeFeatures(float* inAudio, size_t inNumSamples, size_t& outNumFrames)
20{
21 mInputShape[0] = 1;
22 mInputShape[1] = static_cast<int64_t>(inNumSamples);
23 mInputShape[2] = 1;
24
25 mInput.clear();
26 mInput.push_back(
27 Ort::Value::CreateTensor<float>(mMemoryInfo, inAudio, inNumSamples, mInputShape.data(), mInputShape.size()));
28
29 mOutput = mSession.Run(mRunOptions, mInputNames, mInput.data(), 1, mOutputNames, 1);
30
31 auto out_shape = mOutput[0].GetTensorTypeAndShapeInfo().GetShape();
32 assert(out_shape[0] == 1 && out_shape[2] == NUM_FREQ_IN && out_shape[3] == NUM_HARMONICS);
33
34 outNumFrames = static_cast<size_t>(out_shape[1]);
35
36 mInput.clear();
37
38 return mOutput[0].GetTensorData<float>();
39}

Callers 3

feature_testFunction · 0.80
perf_testFunction · 0.80
transcribeToMIDIMethod · 0.80

Calls 1

clearMethod · 0.45

Tested by 2

feature_testFunction · 0.64
perf_testFunction · 0.64