-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
25 lines (20 loc) · 778 Bytes
/
main.cpp
File metadata and controls
25 lines (20 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "objcWrapper.h"
#include <stdlib.h>
#include <iostream>
using namespace std;
int main() {
const void* coremlEncoder = loadModel("coreml/CoremlEncoder.mlmodelc");
// prepare easy test input like torch.ones
float* mel = (float *)malloc(sizeof(float) * 80 * 3000);
for(int i=0;i<80*3000; i++) {
mel[i] = 1.0;
}
// alloc output buffer
int n_state = 384; // tiny=384
float* outFloats = (float *)malloc(sizeof(float) * 1500 * n_state);
predictWith(coremlEncoder, mel, outFloats);
// it should match
// pytorch output: {'output': array([[[-0.28637695, -0.25561523, ..., -0.10253906]]], dtype=float32)
cout << outFloats[0] << " " << outFloats[1] << " " << outFloats[n_state*1500-1];
closeModel(coremlEncoder);
}