ability to load NNs, bt not working properly yet

pull/9/head
David 2019-08-02 07:59:30 +09:30
parent 382b54cee6
commit cea08297f2
2 changed files with 22 additions and 7 deletions

View File

@ -30,7 +30,8 @@
#include "arch.h" #include "arch.h"
#include "lpcnet.h" #include "lpcnet.h"
#include "freq.h" #include "freq.h"
#include "nnet_rw.h"
#include "nnet_data.h"
int main(int argc, char **argv) { int main(int argc, char **argv) {
FILE *fin, *fout; FILE *fin, *fout;
@ -41,17 +42,22 @@ int main(int argc, char **argv) {
int opt_idx = 0; int opt_idx = 0;
while( o != -1 ) { while( o != -1 ) {
static struct option long_opts[] = { static struct option long_opts[] = {
{"mag", no_argument,0, 'i'}, {"mag", no_argument, 0, 'i'},
{"nnet", required_argument, 0, 'n'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
o = getopt_long(argc,argv,"ih",long_opts,&opt_idx); o = getopt_long(argc,argv,"ihn:",long_opts,&opt_idx);
switch(o){ switch(o){
case 'i': case 'i':
logmag = 1; logmag = 1;
fprintf(stderr, "logmag: %d\n", logmag); fprintf(stderr, "logmag: %d\n", logmag);
break; break;
case 'n':
fprintf(stderr, "loading nnet: %s\n", optarg);
nnet_read(optarg);
break;
case '?': case '?':
goto helpmsg; goto helpmsg;
break; break;
@ -84,7 +90,15 @@ int main(int argc, char **argv) {
} }
net = lpcnet_create(); net = lpcnet_create();
//lpcnet_open_test_file(net, "test_lpcnet_states.f32"); //lpcnet_open_test_file(net, "test_lpcnet_states.f32");
#ifdef TEST_UNUSED_BAISES
/* so are top biases used? */
fprintf(stderr, "gru_a_dense_feature.nb_neurons: %d\n", gru_a_dense_feature.nb_neurons);
for(int i=gru_a_dense_feature.nb_neurons; i<2*gru_a_dense_feature.nb_neurons; i++) {
gru_a_dense_feature.bias[i] = 0.0;
}
#endif
while (1) { while (1) {
float in_features[NB_TOTAL_FEATURES]; float in_features[NB_TOTAL_FEATURES];
float features[NB_FEATURES]; float features[NB_FEATURES];

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -x
# test_data_datat.sh # test_data_datat.sh
# Unit test to support refactoring dum_data # Unit test to support refactoring dum_data
@ -25,10 +25,11 @@ TEST_TARG_RAW=190727e_f.raw
# test_synth # test_synth
../build_linux/src/dump_data --test --c2pitch --mag ~/Downloads/$TEST_SRC $TEST_OUT_F32 ../build_linux/src/dump_data --test --c2pitch --mag ~/Downloads/$TEST_SRC $TEST_OUT_F32
../build_linux/src/test_lpcnet --mag $TEST_OUT_F32 $TEST_OUT_RAW ../build_linux/src/test_lpcnet -n ../build_linux/src/t.f32 --mag $TEST_OUT_F32 $TEST_OUT_RAW
diff $TEST_OUT_F32 $TEST_TARG_F32 || { echo "ERROR in test .f32 output! Exiting..."; exit 1; } #../build_linux/src/test_lpcnet --mag $TEST_OUT_F32 $TEST_OUT_RAW
#diff $TEST_OUT_F32 $TEST_TARG_F32 || { echo "ERROR in test .f32 output! Exiting..."; exit 1; }
echo "test .f32 OK" echo "test .f32 OK"
diff $TEST_OUT_RAW $TEST_TARG_RAW || { echo "ERROR in test .raw output! Exiting..."; exit 1; } diff $TEST_OUT_RAW birch.raw || { echo "ERROR in test .raw output! Exiting..."; exit 1; }
echo "test .raw OK" echo "test .raw OK"
echo "all tests PASSED" echo "all tests PASSED"