diff --git a/dnn/lpcnet.c b/dnn/lpcnet.c
index 152c56f197eb7d236338731712d5f8a1088620b9..de5275fdd7294e11b58c34b689ccf318759edff4 100644
--- a/dnn/lpcnet.c
+++ b/dnn/lpcnet.c
@@ -81,10 +81,14 @@ int run_sample_network(NNetState *net, const float *condition, const float *gru_
 {
     float gru_a_input[3*GRU_A_STATE_SIZE];
     float in_b[GRU_A_STATE_SIZE+FEATURE_DENSE2_OUT_SIZE];
+#if 1
+    compute_gru_a_input(gru_a_input, gru_a_condition, GRU_A_STATE_SIZE, &gru_a_embed_sig, last_sig, &gru_a_embed_pred, pred, &gru_a_embed_exc, last_exc);
+#else
     RNN_COPY(gru_a_input, gru_a_condition, 3*GRU_A_STATE_SIZE);
     accum_embedding(&gru_a_embed_sig, gru_a_input, last_sig);
     accum_embedding(&gru_a_embed_pred, gru_a_input, pred);
     accum_embedding(&gru_a_embed_exc, gru_a_input, last_exc);
+#endif
     /*compute_gru3(&gru_a, net->gru_a_state, gru_a_input);*/
     compute_sparse_gru(&sparse_gru_a, net->gru_a_state, gru_a_input);
     RNN_COPY(in_b, net->gru_a_state, GRU_A_STATE_SIZE);
diff --git a/dnn/nnet.c b/dnn/nnet.c
index 84132f452f13de244c76b02b44382b385ed07a28..cf8f39cdd785dc059ad900aa72f8c9b9e563a769 100644
--- a/dnn/nnet.c
+++ b/dnn/nnet.c
@@ -395,6 +395,15 @@ void compute_embedding(const EmbeddingLayer *layer, float *output, int input)
    }    
 }
 
+void compute_gru_a_input(float *output, const float *input, int N, const EmbeddingLayer *layer1, int val1, const EmbeddingLayer *layer2, int val2, const EmbeddingLayer *layer3, int val3) {
+   int i;
+   for (i=0;i<3*N;i++) {
+      output[i] = input[i] + layer1->embedding_weights[val1*layer1->dim + i]
+                           + layer2->embedding_weights[val2*layer2->dim + i]
+                           + layer3->embedding_weights[val3*layer3->dim + i];
+   }
+}
+
 void accum_embedding(const EmbeddingLayer *layer, float *output, int input)
 {
    int i;
diff --git a/dnn/nnet.h b/dnn/nnet.h
index 72ad24e8c4584115cb47a83400841a9f0462f7d6..8e975a882f62f0f6cce2f9e026b2a3838ebbcb10 100644
--- a/dnn/nnet.h
+++ b/dnn/nnet.h
@@ -113,6 +113,8 @@ void compute_embedding(const EmbeddingLayer *layer, float *output, int input);
 
 void accum_embedding(const EmbeddingLayer *layer, float *output, int input);
 
+void compute_gru_a_input(float *output, const float *input, int N, const EmbeddingLayer *layer1, int val1, const EmbeddingLayer *layer2, int val2, const EmbeddingLayer *layer3, int val3);
+
 int sample_from_pdf(const float *pdf, int N, float exp_boost, float pdf_floor);
 
 #endif /* _MLP_H_ */