summaryrefslogtreecommitdiff
path: root/tnet_io/cwrapper.cpp
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-06-05 10:58:38 +0800
committerDeterminant <[email protected]>2015-06-05 10:58:38 +0800
commitbe0e51156e1af9d619160bba1aa7c2eb2df30731 (patch)
tree95f54f08291479480b11d0266ca3b5cc3dec4352 /tnet_io/cwrapper.cpp
parenta753eca0121ac3ec81ed76bd719d3f1cb9522680 (diff)
add debug flag
Diffstat (limited to 'tnet_io/cwrapper.cpp')
-rw-r--r--tnet_io/cwrapper.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/tnet_io/cwrapper.cpp b/tnet_io/cwrapper.cpp
index 4149557..800df2e 100644
--- a/tnet_io/cwrapper.cpp
+++ b/tnet_io/cwrapper.cpp
@@ -53,7 +53,7 @@ extern "C" {
return repo;
}
- Matrix *tnet_feature_repo_read_utterance(TNetFeatureRepo *repo, lua_State *L) {
+ Matrix *tnet_feature_repo_read_utterance(TNetFeatureRepo *repo, lua_State *L, int debug) {
Matrix *mat; /* nerv implementation */
repo->feature_repo.ReadFullMatrix(repo->feats_host);
std::string utter_str = repo->feature_repo.Current().Logical();
@@ -62,7 +62,8 @@ extern "C" {
int m = repo->feats_host.Cols();
mat = nerv_matrix_host_float_new_(L, n, m);
size_t stride = mat->stride;
- fprintf(stderr, "[tnet] feature: %s %d %d\n", utter_str.c_str(), n, m);
+ if (debug)
+ fprintf(stderr, "[tnet] feature: %s %d %d\n", utter_str.c_str(), n, m);
for (int i = 0; i < n; i++)
{
float *row = repo->feats_host.pRowData(i);
@@ -115,7 +116,8 @@ extern "C" {
size_t frames,
size_t sample_rate,
const char *tag,
- lua_State *L) {
+ lua_State *L,
+ int debug) {
std::vector<TNet::Matrix<float> > labs_hosts; /* KaldiLib implementation */
Matrix *mat;
repo->label_repo.GenDesiredMatrixExt(labs_hosts, frames,
@@ -124,7 +126,8 @@ extern "C" {
int m = labs_hosts[0].Cols();
mat = nerv_matrix_host_float_new_(L, n, m);
size_t stride = mat->stride;
- fprintf(stderr, "[tnet] label: %s %d %d\n", tag, n, m);
+ if (debug)
+ fprintf(stderr, "[tnet] label: %s %d %d\n", tag, n, m);
for (int i = 0; i < n; i++)
{
float *row = labs_hosts[0].pRowData(i);