diff --git a/src/nnet2f32.c b/src/nnet2f32.c index 2a9a288..ac57085 100644 --- a/src/nnet2f32.c +++ b/src/nnet2f32.c @@ -1,7 +1,7 @@ /* nnet2f32.c - Writes current compiled-in model to a binary file of floats. + Writes current compiled-in model to a binary file of floats, and runs a few tests. */ #include diff --git a/src/nnet_rw.c b/src/nnet_rw.c index f2c56eb..5cdf598 100644 --- a/src/nnet_rw.c +++ b/src/nnet_rw.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "nnet_data.h" #include "nnet_rw.h" @@ -177,25 +178,11 @@ void read_gru_weights(char *name, const GRULayer *l, FILE *f32) { ret = fread(l->recurrent_weights, sizeof(float), nrecurrent, f32); assert(ret == nrecurrent); } -int sparse_sgemv_count_idx(int rows, const int *idx) -{ - int i, j; - int count = 0; - for (i=0;inb_neurons*6; int ndiag = l->nb_neurons*3; int nrecurrent = l->nb_neurons*l->nb_neurons*3; - int nidx = sparse_sgemv_count_idx(ndiag, l->idx); + int nidx = 32767; printf("%s: %d %d %d %d\n", name, nbias, ndiag, nrecurrent, nidx); fwrite(l->bias, sizeof(float), nbias, f32); fwrite(l->diag_weights, sizeof(float), ndiag, f32); @@ -207,7 +194,7 @@ void check_sparse_gru_weights(char *name, const SparseGRULayer *l, FILE *f32) { int nbias = l->nb_neurons*6; int ndiag = l->nb_neurons*3; int nrecurrent = l->nb_neurons*l->nb_neurons*3; - int nidx = sparse_sgemv_count_idx(ndiag, l->idx); + int nidx = 32767; printf("%s: %d %d %d %d", name, nbias, ndiag, nrecurrent, nidx); check(l->bias, nbias, f32); check(l->diag_weights, ndiag, f32); @@ -220,9 +207,9 @@ void read_sparse_gru_weights(char *name, const SparseGRULayer *l, FILE *f32) { int nbias = l->nb_neurons*6; int ndiag = l->nb_neurons*3; int nrecurrent = l->nb_neurons*l->nb_neurons*3; - int nidx = sparse_sgemv_count_idx(ndiag, l->idx); - printf("%s: %d %d %d %d\n", name, nbias, ndiag, nrecurrent, nidx); int ret; + int nidx = 32767; + printf("%s: %d %d %d %d\n", name, nbias, ndiag, nrecurrent, nidx); ret = fread(l->bias, sizeof(float), nbias, f32); assert(ret == nbias); ret = fread(l->diag_weights, sizeof(float), ndiag, f32); assert(ret == ndiag); ret = fread(l->recurrent_weights, sizeof(float), nrecurrent, f32); assert(ret == nrecurrent);