Skip to content

Commit 24f8423

Browse files
Clocking keyword detection trials
1 parent dd15528 commit 24f8423

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

c_reference/tests/kws/test_keyword_spotting.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include<stdio.h>
55
#include<stdlib.h>
66
#include<string.h>
7+
#include <time.h>
78

89
#include"keyword_spotting_io_2.h"
910
#include"precnn_params.h"
@@ -16,7 +17,7 @@
1617
#include"utils.h"
1718

1819

19-
// Check out time with GD
20+
// Check out time steps with label time steps
2021
int checkTime(unsigned out_T){
2122
if(out_T != O_T){
2223
printf("Error, Estimated Output and Actual ouput time axis mis-match");
@@ -148,7 +149,7 @@ void key_word_spotting(float* mem_buf){
148149
&conv_params, PRE_CNN_FILT_ACT); // regular tanh activation
149150

150151
BatchNorm1d(0, cnn1_out, in_T, PRE_CNN_O_F,
151-
BNORM_RNN_MEAN, BNORM_RNN_VAR, 0, 0, 0, 1, 0.00001); // Inplace activation
152+
BNORM_RNN_MEAN, BNORM_RNN_VAR, 0, 0, 0, 1, 0.00001); // Inplace computation
152153

153154
/* Bricked Bi-FastGRNN Block */
154155
int fwd_window = 60, hop = 3, bwd_window = 15, rnn_hidden = RNN_O_F>>1, out_index = 0;
@@ -258,8 +259,13 @@ void key_word_spotting(float* mem_buf){
258259
}
259260

260261
int main(){
261-
262+
263+
clock_t begin = clock();
262264
key_word_spotting(INPUT);
265+
clock_t end = clock();
266+
double time_spent = (float)(end - begin) / CLOCKS_PER_SEC;
267+
printf("Time elapsed is %f seconds\n", time_spent);
268+
263269

264270
return 0 ;
265271
}

0 commit comments

Comments
 (0)