summaryrefslogtreecommitdiff
path: root/tnet_io/test.c
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-05-30 15:27:01 +0800
committerDeterminant <[email protected]>2015-05-30 15:27:01 +0800
commit3b156cd0cd19aa7db97082161921064a0a871328 (patch)
treef58a2f25edbc5b3495756370fae6c33aab4f54c9 /tnet_io/test.c
parent54546414d1700ed34bf2fe896f36e86e59850b63 (diff)
add nerv interface for TNet IO
Diffstat (limited to 'tnet_io/test.c')
-rw-r--r--tnet_io/test.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/tnet_io/test.c b/tnet_io/test.c
index 397b249..a5b8f55 100644
--- a/tnet_io/test.c
+++ b/tnet_io/test.c
@@ -1,41 +1,39 @@
#include "cwrapper.h"
#include <stdio.h>
-extern "C" {
- void print_nerv_matrix(Matrix *mat) {
- int n = mat->nrow;
- int m = mat->ncol;
- int i, j;
- size_t stride = mat->stride;
- for (i = 0; i < n; i++)
- {
+void print_nerv_matrix(Matrix *mat) {
+ int n = mat->nrow;
+ int m = mat->ncol;
+ int i, j;
+ size_t stride = mat->stride;
+ for (i = 0; i < n; i++)
+ {
- float *nerv_row = (float *)((char *)mat->data.f + i * stride);
- for (j = 0; j < m; j++)
- fprintf(stderr, "%.8f ", nerv_row[j]);
- fprintf(stderr, "\n");
- }
+ float *nerv_row = (float *)((char *)mat->data.f + i * stride);
+ for (j = 0; j < m; j++)
+ fprintf(stderr, "%.8f ", nerv_row[j]);
+ fprintf(stderr, "\n");
}
+}
- int main() {
- fprintf(stderr, "init repo\n");
- TNetFeatureRepo *feat_repo = tnet_feature_repo_new(
- "/slfs1/users/mfy43/swb_ivec/train_bp.scp",
- "/slfs1/users/mfy43/swb_ivec/plp_0_d_a.conf", 5);
- Matrix *feat_utter;
- feat_utter = tnet_feature_repo_read_utterance(feat_repo);
+int main() {
+ fprintf(stderr, "init repo\n");
+ TNetFeatureRepo *feat_repo = tnet_feature_repo_new(
+ "/slfs1/users/mfy43/swb_ivec/train_bp.scp",
+ "/slfs1/users/mfy43/swb_ivec/plp_0_d_a.conf", 5);
+ Matrix *feat_utter;
+ feat_utter = tnet_feature_repo_read_utterance(feat_repo);
- TNetLabelRepo *lab_repo = tnet_label_repo_new(
- "/slfs1/users/mfy43/swb_ivec/ref.mlf",
- "map",
- "/slfs1/users/mfy43/swb_ivec/dict",
- "*/",
- "lab");
- Matrix *lab_utter = tnet_label_repo_read_utterance(lab_repo,
- feat_utter->nrow - 5 * 2,
- tnet_feature_repo_current_samplerate(feat_repo),
- tnet_feature_repo_current_tag(feat_repo));
- print_nerv_matrix(lab_utter);
- return 0;
- }
+ TNetLabelRepo *lab_repo = tnet_label_repo_new(
+ "/slfs1/users/mfy43/swb_ivec/ref.mlf",
+ "map",
+ "/slfs1/users/mfy43/swb_ivec/dict",
+ "*/",
+ "lab");
+ Matrix *lab_utter = tnet_label_repo_read_utterance(lab_repo,
+ feat_utter->nrow - 5 * 2,
+ tnet_feature_repo_current_samplerate(feat_repo),
+ tnet_feature_repo_current_tag(feat_repo));
+ print_nerv_matrix(lab_utter);
+ return 0;
}