mirror of
https://github.com/xiph/opus.git
synced 2025-06-06 07:21:03 +00:00
Fixing includes
This commit is contained in:
parent
37fbcaee0b
commit
141830ce5a
2 changed files with 14 additions and 4 deletions
|
@ -134,15 +134,23 @@ model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=
|
||||||
|
|
||||||
model.load_weights(sys.argv[1])
|
model.load_weights(sys.argv[1])
|
||||||
|
|
||||||
f = open(sys.argv[2], 'w')
|
if len(sys.argv) > 2:
|
||||||
hf = open(sys.argv[3], 'w')
|
cfile = sys.argv[2];
|
||||||
|
hfile = sys.argv[3];
|
||||||
|
else:
|
||||||
|
cfile = 'nnet_data.c'
|
||||||
|
hfile = 'nnet_data.h'
|
||||||
|
|
||||||
|
|
||||||
|
f = open(cfile, 'w')
|
||||||
|
hf = open(hfile, 'w')
|
||||||
|
|
||||||
|
|
||||||
f.write('/*This file is automatically generated from a Keras model*/\n\n')
|
f.write('/*This file is automatically generated from a Keras model*/\n\n')
|
||||||
f.write('#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif\n\n#include "nnet.h"\n#include "foo.h"\n\n')
|
f.write('#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif\n\n#include "nnet.h"\n#include "{}"\n\n'.format(hfile))
|
||||||
|
|
||||||
hf.write('/*This file is automatically generated from a Keras model*/\n\n')
|
hf.write('/*This file is automatically generated from a Keras model*/\n\n')
|
||||||
hf.write('#ifndef RNN_DATA_H\n#define RNN_DATA_H\n\n#include "{}"\n\n'.format(sys.argv[3]))
|
hf.write('#ifndef RNN_DATA_H\n#define RNN_DATA_H\n\n#include "nnet.h"\n\n')
|
||||||
|
|
||||||
layer_list = []
|
layer_list = []
|
||||||
for i, layer in enumerate(model.layers):
|
for i, layer in enumerate(model.layers):
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "tansig_table.h"
|
#include "tansig_table.h"
|
||||||
#include "nnet.h"
|
#include "nnet.h"
|
||||||
|
#include "nnet_data.h"
|
||||||
|
|
||||||
static OPUS_INLINE float tansig_approx(float x)
|
static OPUS_INLINE float tansig_approx(float x)
|
||||||
{
|
{
|
||||||
|
@ -136,6 +137,7 @@ void compute_mdense(const MDenseLayer *layer, float *output, const float *input)
|
||||||
M = layer->nb_inputs;
|
M = layer->nb_inputs;
|
||||||
N = layer->nb_neurons;
|
N = layer->nb_neurons;
|
||||||
C = layer->nb_channels;
|
C = layer->nb_channels;
|
||||||
|
celt_assert(N*C <= MAX_MDENSE_TMP);
|
||||||
stride = N*C;
|
stride = N*C;
|
||||||
for (i=0;i<N*C;i++)
|
for (i=0;i<N*C;i++)
|
||||||
tmp[i] = layer->bias[i];
|
tmp[i] = layer->bias[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue