From 39b1967870e6fabe6764360bccefad8a2a9db24d Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 24 Feb 2016 17:00:40 +0800 Subject: adjust the code according to the changes made in nerv/wrapped-handles --- htk_io/Makefile | 3 ++- htk_io/src/cwrapper.cpp | 15 +++++++++------ htk_io/src/cwrapper.h | 9 +++++---- htk_io/src/init.c | 12 +++++++++--- htk_io/src/test.c | 7 +++++-- kaldi_decode/src/nnet-forward.cc | 6 +++--- kaldi_io/Makefile | 5 +++-- kaldi_io/src/cwrapper_kaldi.cpp | 29 +++++++++++++++++------------ kaldi_io/src/cwrapper_kaldi.h | 15 ++++++++++----- kaldi_io/src/init.c | 17 +++++++++++++---- kaldi_io/src/test.c | 7 +++++-- kaldi_seq/src/init.c | 2 +- kaldi_seq/src/kaldi_mmi.cpp | 5 +++-- kaldi_seq/src/kaldi_mmi.h | 4 ++-- kaldi_seq/src/kaldi_mpe.cpp | 5 +++-- kaldi_seq/src/kaldi_mpe.h | 4 ++-- 16 files changed, 92 insertions(+), 53 deletions(-) diff --git a/htk_io/Makefile b/htk_io/Makefile index d32d17a..fe9593d 100644 --- a/htk_io/Makefile +++ b/htk_io/Makefile @@ -17,6 +17,7 @@ OBJ_SUBDIR := $(addprefix $(OBJ_DIR)/,$(SUBDIR)) LUA_SUBDIR := $(addprefix $(LUA_DIR)/,$(SUBDIR)) LUA_LIBS := $(addprefix $(LUA_DIR)/,$(LUA_LIBS)) LIB_PATH := $(LUA_BINDIR)/../lib +LUALIB_PATH := $(LUA_BINDIR)/../lib/lua/5.1/ build: $(OBJ_DIR) $(OBJ_SUBDIR) $(OBJS) tnet $(OBJ_DIR)/src/test install: $(LUA_DIR) $(LUA_SUBDIR) $(LUA_LIBS) $(LIBS) @@ -26,7 +27,7 @@ $(OBJ_DIR) $(LUA_DIR) $(OBJ_SUBDIR) $(LUA_SUBDIR): $(LUA_DIR)/%.lua: %.lua cp $< $@ $(LIBS): $(OBJ_DIR)/src/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/src/init.o $(OBJ_DIR)/src/libKaldiLib.a - gcc -shared -o $@ $(OBJ_DIR)/src/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/src/libKaldiLib.a $(OBJ_DIR)/src/init.o -lstdc++ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnervcore -lluaT + gcc -shared -o $@ $(OBJ_DIR)/src/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/src/libKaldiLib.a $(OBJ_DIR)/src/init.o -lstdc++ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnervcore -Wl,-rpath=$(LUALIB_PATH) -L$(LUALIB_PATH) -lnerv -lluaT $(OBJ_DIR)/src/test: $(OBJ_DIR)/src/cwrapper.o $(OBJ_DIR)/src/test.o $(OBJ_DIR)/src/libKaldiLib.a gcc -o $@ $^ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnervcore -Wl,-rpath=$(LUA_LIBDIR) -L$(LUA_LIBDIR) -lluajit-5.1 -lstdc++ -lm $(OBJ_DIR)/src/cwrapper.o: src/cwrapper.cpp diff --git a/htk_io/src/cwrapper.cpp b/htk_io/src/cwrapper.cpp index b7ce2d5..efb5628 100644 --- a/htk_io/src/cwrapper.cpp +++ b/htk_io/src/cwrapper.cpp @@ -8,9 +8,10 @@ extern "C" { #include "cwrapper.h" #include "string.h" -#include "nerv/common.h" +#include "nerv/lib/common.h" +#include "nerv/lib/matrix/mmatrix.h" - extern Matrix *nerv_matrix_host_float_create(long nrow, long ncol, Status *status); + extern Matrix *nerv_matrix_host_float_create(long nrow, long ncol, MContext *context, Status *status); struct TNetFeatureRepo { TNet::FeatureRepository feature_repo; @@ -53,7 +54,8 @@ extern "C" { return repo; } - Matrix *tnet_feature_repo_read_utterance(TNetFeatureRepo *repo, lua_State *L, int debug) { + Matrix *tnet_feature_repo_read_utterance(TNetFeatureRepo *repo, lua_State *L, + int debug, MContext *context) { Matrix *mat; /* nerv implementation */ repo->feature_repo.ReadFullMatrix(repo->feats_host); std::string utter_str = repo->feature_repo.Current().Logical(); @@ -61,7 +63,7 @@ extern "C" { int n = repo->feats_host.Rows(); int m = repo->feats_host.Cols(); Status status; - mat = nerv_matrix_host_float_create(n, m, &status); + mat = nerv_matrix_host_float_create(n, m, context, &status); NERV_LUA_CHECK_STATUS(L, status); size_t stride = mat->stride; if (debug) @@ -119,7 +121,8 @@ extern "C" { size_t sample_rate, const char *tag, lua_State *L, - int debug) { + int debug, + MContext *context) { std::vector > labs_hosts; /* KaldiLib implementation */ Matrix *mat; repo->label_repo.GenDesiredMatrixExt(labs_hosts, frames, @@ -127,7 +130,7 @@ extern "C" { int n = labs_hosts[0].Rows(); int m = labs_hosts[0].Cols(); Status status; - mat = nerv_matrix_host_float_create(n, m, &status); + mat = nerv_matrix_host_float_create(n, m, context, &status); NERV_LUA_CHECK_STATUS(L, status); size_t stride = mat->stride; if (debug) diff --git a/htk_io/src/cwrapper.h b/htk_io/src/cwrapper.h index e1bce6e..0469773 100644 --- a/htk_io/src/cwrapper.h +++ b/htk_io/src/cwrapper.h @@ -1,7 +1,7 @@ #ifndef NERV_TNET_IO_CWRAPPER #define NERV_TNET_IO_CWRAPPER -#include "nerv/matrix/matrix.h" -#include "nerv/common.h" +#include "nerv/lib/matrix/mmatrix.h" +#include "nerv/lib/common.h" #ifdef __cplusplus extern "C" { #endif @@ -10,7 +10,7 @@ extern "C" { TNetFeatureRepo *tnet_feature_repo_new(const char *scp, const char *config, int context); - Matrix *tnet_feature_repo_read_utterance(TNetFeatureRepo *repo, lua_State *L, int debug); + Matrix *tnet_feature_repo_read_utterance(TNetFeatureRepo *repo, lua_State *L, int debug, MContext *context); size_t tnet_feature_repo_current_samplerate(TNetFeatureRepo *repo); const char *tnet_feature_repo_current_tag(TNetFeatureRepo *repo); void tnet_feature_repo_next(TNetFeatureRepo *repo); @@ -28,7 +28,8 @@ extern "C" { size_t sample_rate, const char *tag, lua_State *L, - int debug); + int debug, + MContext *context); void tnet_label_repo_destroy(TNetLabelRepo *repo); #ifdef __cplusplus diff --git a/htk_io/src/init.c b/htk_io/src/init.c index 8a1ec3b..a5132ba 100644 --- a/htk_io/src/init.c +++ b/htk_io/src/init.c @@ -1,4 +1,5 @@ -#include "nerv/common.h" +#include "nerv/lib/common.h" +#include "nerv/matrix/matrix.h" #include "cwrapper.h" #include @@ -28,12 +29,14 @@ static int feat_repo_current_tag(lua_State *L) { } static int feat_repo_current_utterance(lua_State *L) { + MContext *context; + MMATRIX_GET_CONTEXT(L, 3); TNetFeatureRepo *repo = luaT_checkudata(L, 1, nerv_tnet_feat_repo_tname); int debug; if (!lua_isboolean(L, 2)) nerv_error(L, "debug flag should be a boolean"); debug = lua_toboolean(L, 2); - Matrix *utter = tnet_feature_repo_read_utterance(repo, L, debug); + Matrix *utter = tnet_feature_repo_read_utterance(repo, L, debug, context); luaT_pushudata(L, utter, nerv_matrix_host_float_tname); return 1; } @@ -72,6 +75,8 @@ static int label_repo_new(lua_State *L) { } static int label_repo_read_utterance(lua_State *L) { + MContext *context; + MMATRIX_GET_CONTEXT(L, 5); TNetLabelRepo *repo = luaT_checkudata(L, 1, nerv_tnet_label_repo_tname); TNetFeatureRepo *feat_repo = luaT_checkudata(L, 2, nerv_tnet_feat_repo_tname); size_t frames = luaL_checkinteger(L, 3); @@ -82,7 +87,8 @@ static int label_repo_read_utterance(lua_State *L) { Matrix *utter = tnet_label_repo_read_utterance(repo, frames, tnet_feature_repo_current_samplerate(feat_repo), - tnet_feature_repo_current_tag(feat_repo), L, debug); + tnet_feature_repo_current_tag(feat_repo), + L, debug, context); luaT_pushudata(L, utter, nerv_matrix_host_float_tname); return 1; } diff --git a/htk_io/src/test.c b/htk_io/src/test.c index 6812ef1..1ced108 100644 --- a/htk_io/src/test.c +++ b/htk_io/src/test.c @@ -1,6 +1,9 @@ #include "cwrapper.h" +#include "nerv/lib/matrix/mmatrix.h" #include +MContext context; + void print_nerv_matrix(Matrix *mat) { int n = mat->nrow; int m = mat->ncol; @@ -22,7 +25,7 @@ int main() { "/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, NULL, 1); + feat_utter = tnet_feature_repo_read_utterance(feat_repo, NULL, 1, &context); TNetLabelRepo *lab_repo = tnet_label_repo_new( "/slfs1/users/mfy43/swb_ivec/ref.mlf", @@ -34,7 +37,7 @@ int main() { feat_utter->nrow - 5 * 2, tnet_feature_repo_current_samplerate(feat_repo), tnet_feature_repo_current_tag(feat_repo), NULL, - 1); + 1, &context); print_nerv_matrix(lab_utter); return 0; } diff --git a/kaldi_decode/src/nnet-forward.cc b/kaldi_decode/src/nnet-forward.cc index 007f623..4911791 100644 --- a/kaldi_decode/src/nnet-forward.cc +++ b/kaldi_decode/src/nnet-forward.cc @@ -21,9 +21,9 @@ extern "C"{ #include "lua.h" #include "lauxlib.h" #include "lualib.h" -#include "nerv/matrix/matrix.h" -#include "nerv/common.h" -#include "nerv/luaT/luaT.h" +#include "nerv/lib/matrix/matrix.h" +#include "nerv/lib/common.h" +#include "nerv/lib/luaT/luaT.h" } #include diff --git a/kaldi_io/Makefile b/kaldi_io/Makefile index 1066fc5..13b365f 100644 --- a/kaldi_io/Makefile +++ b/kaldi_io/Makefile @@ -1,5 +1,5 @@ # Change KDIR to `kaldi-trunk' path (Kaldi must be compiled with --share) -KDIR := /home/stuymf/kaldi-trunk/ +KDIR := /slfs1/users/ymz09/kaldi/ SHELL := /bin/bash BUILD_DIR := $(CURDIR)/build @@ -20,6 +20,7 @@ OBJ_SUBDIR := $(addprefix $(OBJ_DIR)/,$(SUBDIR)) LUA_SUBDIR := $(addprefix $(LUA_DIR)/,$(SUBDIR)) LUA_LIBS := $(addprefix $(LUA_DIR)/,$(LUA_LIBS)) LIB_PATH := $(LUA_BINDIR)/../lib +LUALIB_PATH := $(LUA_BINDIR)/../lib/lua/5.1/ build: $(OBJ_DIR) $(OBJ_SUBDIR) $(OBJS) $(OBJ_DIR)/src/test install: $(LUA_DIR) $(LUA_SUBDIR) $(LUA_LIBS) $(LIBS) @@ -32,7 +33,7 @@ $(OBJ_DIR) $(LUA_DIR) $(OBJ_SUBDIR) $(LUA_SUBDIR): $(LUA_DIR)/%.lua: %.lua cp $< $@ $(LIBS): $(OBJ_DIR)/src/cwrapper_kaldi.o $(OBJ_DIR)/init.o $(OBJ_DIR)/src/init.o - gcc -shared -fPIC -o $@ $(OBJ_DIR)/src/cwrapper_kaldi.o $(OBJ_DIR)/init.o $(OBJ_DIR)/src/init.o -lstdc++ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnervcore -lluaT $(KL) + gcc -shared -fPIC -o $@ $(OBJ_DIR)/src/cwrapper_kaldi.o $(OBJ_DIR)/init.o $(OBJ_DIR)/src/init.o -lstdc++ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnervcore -Wl,-rpath=$(LUALIB_PATH) -L$(LUALIB_PATH) -lnerv -lluaT $(KL) $(OBJ_DIR)/src/cwrapper_kaldi.o: src/cwrapper_kaldi.cpp g++ -o $@ -c $< -DHAVE_ATLAS $(KALDIINCLUDE) -g -fPIC $(INCLUDE) -DKALDI_DOUBLEPRECISION=0 -msse2 -DHAVE_POSIX_MEMALIGN $(OBJ_DIR)/src/test: $(OBJ_DIR)/src/cwrapper_kaldi.o $(OBJ_DIR)/src/test.o diff --git a/kaldi_io/src/cwrapper_kaldi.cpp b/kaldi_io/src/cwrapper_kaldi.cpp index d16f316..83331ce 100644 --- a/kaldi_io/src/cwrapper_kaldi.cpp +++ b/kaldi_io/src/cwrapper_kaldi.cpp @@ -10,10 +10,11 @@ extern "C" { #include "cwrapper_kaldi.h" #include "string.h" #include "assert.h" -#include "nerv/common.h" +#include "nerv/lib/common.h" +#include "nerv/lib/matrix/mmatrix.h" - extern Matrix *nerv_matrix_host_float_create(long nrow, long ncol, Status *status); - extern Matrix *nerv_matrix_host_double_create(long nrow, long ncol, Status *status); + extern Matrix *nerv_matrix_host_float_create(long nrow, long ncol, MContext *context, Status *status); + extern Matrix *nerv_matrix_host_double_create(long nrow, long ncol, MContext *context, Status *status); struct KaldiFeatureRepo { kaldi::SequentialBaseFloatMatrixReader* feature_reader; @@ -26,7 +27,8 @@ extern "C" { return repo; } - Matrix *kaldi_feature_repo_read_utterance(KaldiFeatureRepo *repo, lua_State *L, int debug) { + Matrix *kaldi_feature_repo_read_utterance(KaldiFeatureRepo *repo, lua_State *L, + int debug, MContext *context) { Matrix *mat; /* nerv implementation */ repo->utt = repo->feature_reader->Key(); @@ -37,9 +39,9 @@ extern "C" { Status status; assert(sizeof(BaseFloat) == sizeof(float)); if(sizeof(BaseFloat) == sizeof(float)) - mat = nerv_matrix_host_float_create(n, m, &status); + mat = nerv_matrix_host_float_create(n, m, context, &status); else if(sizeof(BaseFloat) == sizeof(double)) - mat = nerv_matrix_host_double_create(n, m, &status); + mat = nerv_matrix_host_double_create(n, m, context, &status); NERV_LUA_CHECK_STATUS(L, status); size_t stride = mat->stride; if (debug) @@ -99,7 +101,10 @@ extern "C" { return repo; } - Matrix *kaldi_lookup_feature_repo_read_utterance(KaldiLookupFeatureRepo *repo, KaldiFeatureRepo *frepo, int nframes, lua_State *L, int debug) { + Matrix *kaldi_lookup_feature_repo_read_utterance(KaldiLookupFeatureRepo *repo, + KaldiFeatureRepo *frepo, + int nframes, lua_State *L, + int debug, MContext *context) { Matrix *mat; /* nerv implementation */ StringToString_t::iterator mit = repo->map.find(frepo->utt); if (mit == repo->map.end()) @@ -115,9 +120,9 @@ extern "C" { Status status; assert(sizeof(BaseFloat) == sizeof(float)); if(sizeof(BaseFloat) == sizeof(float)) - mat = nerv_matrix_host_float_create(n, m, &status); + mat = nerv_matrix_host_float_create(n, m, context, &status); else if(sizeof(BaseFloat) == sizeof(double)) - mat = nerv_matrix_host_double_create(n, m, &status); + mat = nerv_matrix_host_double_create(n, m, context, &status); NERV_LUA_CHECK_STATUS(L, status); size_t stride = mat->stride; if (debug) @@ -149,7 +154,7 @@ extern "C" { Matrix *kaldi_label_repo_read_utterance(KaldiLabelRepo *repo, KaldiFeatureRepo *frepo, int nframes, lua_State *L, - int debug) { + int debug, MContext *context) { Matrix *mat; kaldi::Posterior targets = repo->targets_reader->Value(frepo->utt); @@ -159,9 +164,9 @@ extern "C" { Status status; assert(sizeof(BaseFloat) == sizeof(float)); if(sizeof(BaseFloat) == sizeof(float)) - mat = nerv_matrix_host_float_create(n, m, &status); + mat = nerv_matrix_host_float_create(n, m, context, &status); else if(sizeof(BaseFloat) == sizeof(double)) - mat = nerv_matrix_host_double_create(n, m, &status); + mat = nerv_matrix_host_double_create(n, m, context, &status); NERV_LUA_CHECK_STATUS(L, status); size_t stride = mat->stride; if (debug) diff --git a/kaldi_io/src/cwrapper_kaldi.h b/kaldi_io/src/cwrapper_kaldi.h index c8a7a25..db20087 100644 --- a/kaldi_io/src/cwrapper_kaldi.h +++ b/kaldi_io/src/cwrapper_kaldi.h @@ -1,7 +1,7 @@ #ifndef NERV_kaldi_KALDI_IO_CWRAPPER #define NERV_kaldi_KALDI_IO_CWRAPPER -#include "nerv/matrix/matrix.h" -#include "nerv/common.h" +#include "nerv/lib/matrix/mmatrix.h" +#include "nerv/lib/common.h" #ifdef __cplusplus extern "C" { #endif @@ -9,7 +9,8 @@ extern "C" { typedef struct KaldiFeatureRepo KaldiFeatureRepo; KaldiFeatureRepo *kaldi_feature_repo_new(const char *); - Matrix *kaldi_feature_repo_read_utterance(KaldiFeatureRepo *repo, lua_State *L, int debug); + Matrix *kaldi_feature_repo_read_utterance(KaldiFeatureRepo *repo, lua_State *L, + int debug, MContext *context); void kaldi_feature_repo_next(KaldiFeatureRepo *repo); int kaldi_feature_repo_is_end(KaldiFeatureRepo *repo); const char *kaldi_feature_repo_key(KaldiFeatureRepo *repo); @@ -21,14 +22,18 @@ extern "C" { Matrix *kaldi_label_repo_read_utterance(KaldiLabelRepo *repo, KaldiFeatureRepo *, int, lua_State *L, - int debug); + int debug, + MContext *context); void kaldi_label_repo_destroy(KaldiLabelRepo *repo); typedef struct KaldiLookupFeatureRepo KaldiLookupFeatureRepo; KaldiLookupFeatureRepo *kaldi_lookup_feature_repo_new(const char *, const char *); - Matrix *kaldi_lookup_feature_repo_read_utterance(KaldiLookupFeatureRepo *repo, KaldiFeatureRepo *frepo, int nframes, lua_State *L, int debug); + Matrix *kaldi_lookup_feature_repo_read_utterance(KaldiLookupFeatureRepo *repo, + KaldiFeatureRepo *frepo, + int nframes, lua_State *L, + int debug, MContext *context); void kaldi_lookup_feature_repo_destroy(KaldiLookupFeatureRepo *repo); #ifdef __cplusplus diff --git a/kaldi_io/src/init.c b/kaldi_io/src/init.c index 529895b..e8b4ea6 100644 --- a/kaldi_io/src/init.c +++ b/kaldi_io/src/init.c @@ -1,4 +1,5 @@ -#include "nerv/common.h" +#include "nerv/lib/common.h" +#include "nerv/matrix/matrix.h" #include "cwrapper_kaldi.h" #include @@ -21,12 +22,14 @@ static int feat_repo_destroy(lua_State *L) { } static int feat_repo_current_utterance(lua_State *L) { + MContext *context; + MMATRIX_GET_CONTEXT(L, 3); KaldiFeatureRepo *repo = luaT_checkudata(L, 1, nerv_kaldi_feat_repo_tname); int debug; if (!lua_isboolean(L, 2)) nerv_error(L, "debug flag should be a boolean"); debug = lua_toboolean(L, 2); - Matrix *utter = kaldi_feature_repo_read_utterance(repo, L, debug); + Matrix *utter = kaldi_feature_repo_read_utterance(repo, L, debug, context); luaT_pushudata(L, utter, nerv_matrix_host_float_tname); return 1; } @@ -72,6 +75,8 @@ static int lookup_feat_repo_destroy(lua_State *L) { } static int lookup_feat_repo_read_utterance(lua_State *L) { + MContext *context; + MMATRIX_GET_CONTEXT(L, 5); KaldiLookupFeatureRepo *repo = luaT_checkudata(L, 1, nerv_kaldi_lookup_feat_repo_tname); KaldiFeatureRepo *feat_repo = luaT_checkudata(L, 2, nerv_kaldi_feat_repo_tname); int nframes, debug; @@ -81,7 +86,8 @@ static int lookup_feat_repo_read_utterance(lua_State *L) { if (!lua_isboolean(L, 4)) nerv_error(L, "debug flag should be a boolean"); debug = lua_toboolean(L, 4); - Matrix *utter = kaldi_lookup_feature_repo_read_utterance(repo, feat_repo, nframes, L, debug); + Matrix *utter = kaldi_lookup_feature_repo_read_utterance(repo, feat_repo, + nframes, L, debug, context); luaT_pushudata(L, utter, nerv_matrix_host_float_tname); return 1; } @@ -100,6 +106,8 @@ static int label_repo_new(lua_State *L) { } static int label_repo_read_utterance(lua_State *L) { + MContext *context; + MMATRIX_GET_CONTEXT(L, 5); KaldiLabelRepo *repo = luaT_checkudata(L, 1, nerv_kaldi_label_repo_tname); KaldiFeatureRepo *feat_repo = luaT_checkudata(L, 2, nerv_kaldi_feat_repo_tname); int nframes, debug; @@ -109,7 +117,8 @@ static int label_repo_read_utterance(lua_State *L) { if (!lua_isboolean(L, 4)) nerv_error(L, "debug flag should be a boolean"); debug = lua_toboolean(L, 4); - Matrix *utter = kaldi_label_repo_read_utterance(repo, feat_repo, nframes, L, debug); + Matrix *utter = kaldi_label_repo_read_utterance(repo, feat_repo, nframes, + L, debug, context); luaT_pushudata(L, utter, nerv_matrix_host_float_tname); return 1; } diff --git a/kaldi_io/src/test.c b/kaldi_io/src/test.c index e92b4c9..e3368df 100644 --- a/kaldi_io/src/test.c +++ b/kaldi_io/src/test.c @@ -7,8 +7,11 @@ **********************************************************************************/ #include "cwrapper_kaldi.h" +#include "nerv/lib/matrix/mmatrix.h" #include +MContext context; + char feature_rspecifier[] = {"ark:/slfs6/users/ymz09/kaldi/src/featbin/copy-feats scp:/slfs6/users/ymz09/swb_ivec/train_bp.scp ark:- |"}; void print_nerv_matrix(Matrix *mat) { @@ -30,13 +33,13 @@ int main(int argc, char *argv[]) Matrix *mat; KaldiFeatureRepo *repo = kaldi_feature_repo_new(feature_rspecifier); - mat = kaldi_feature_repo_read_utterance(repo, NULL, 1); + mat = kaldi_feature_repo_read_utterance(repo, NULL, 1, &context); printf("1st uttrance\n"); print_nerv_matrix(mat); kaldi_feature_repo_next(repo); - mat = kaldi_feature_repo_read_utterance(repo, NULL, 1); + mat = kaldi_feature_repo_read_utterance(repo, NULL, 1, &context); printf("2nd uttrance\n"); print_nerv_matrix(mat); diff --git a/kaldi_seq/src/init.c b/kaldi_seq/src/init.c index 9b38056..c2002cf 100644 --- a/kaldi_seq/src/init.c +++ b/kaldi_seq/src/init.c @@ -1,4 +1,4 @@ -#include "nerv/common.h" +#include "nerv/lib/common.h" #include "kaldi_mpe.h" #include "kaldi_mmi.h" #include diff --git a/kaldi_seq/src/kaldi_mmi.cpp b/kaldi_seq/src/kaldi_mmi.cpp index ea9b4f1..6f8dad9 100644 --- a/kaldi_seq/src/kaldi_mmi.cpp +++ b/kaldi_seq/src/kaldi_mmi.cpp @@ -36,9 +36,10 @@ extern "C" { #include "kaldi_mmi.h" #include "string.h" #include "assert.h" -#include "nerv/common.h" +#include "nerv/lib/common.h" +#include "nerv/lib/matrix/mmatrix.h" - extern NervMatrix *nerv_matrix_host_float_create(long nrow, long ncol, Status *status); + extern NervMatrix *nerv_matrix_host_float_create(long nrow, long ncol, MContext *context, Status *status); extern void nerv_matrix_host_float_copy_fromd(NervMatrix *mat, const NervMatrix *cumat, int, int, int, Status *); using namespace kaldi; using namespace kaldi::nnet1; diff --git a/kaldi_seq/src/kaldi_mmi.h b/kaldi_seq/src/kaldi_mmi.h index ce6787c..6175479 100644 --- a/kaldi_seq/src/kaldi_mmi.h +++ b/kaldi_seq/src/kaldi_mmi.h @@ -1,7 +1,7 @@ #ifndef NERV_kaldi_KALDI_MMI #define NERV_kaldi_KALDI_MMI -#include "nerv/matrix/matrix.h" -#include "nerv/common.h" +#include "nerv/lib/matrix/matrix.h" +#include "nerv/lib/common.h" #ifdef __cplusplus extern "C" { #endif diff --git a/kaldi_seq/src/kaldi_mpe.cpp b/kaldi_seq/src/kaldi_mpe.cpp index 60384e2..5d4149c 100644 --- a/kaldi_seq/src/kaldi_mpe.cpp +++ b/kaldi_seq/src/kaldi_mpe.cpp @@ -68,9 +68,10 @@ extern "C" { #include "kaldi_mpe.h" #include "string.h" #include "assert.h" -#include "nerv/common.h" +#include "nerv/lib/common.h" +#include "nerv/lib/matrix/mmatrix.h" - extern NervMatrix *nerv_matrix_host_float_create(long nrow, long ncol, Status *status); + extern NervMatrix *nerv_matrix_host_float_create(long nrow, long ncol, MContext *context, Status *status); extern void nerv_matrix_host_float_copy_fromd(NervMatrix *mat, const NervMatrix *cumat, int, int, int, Status *); using namespace kaldi; using namespace kaldi::nnet1; diff --git a/kaldi_seq/src/kaldi_mpe.h b/kaldi_seq/src/kaldi_mpe.h index fd09574..218cff5 100644 --- a/kaldi_seq/src/kaldi_mpe.h +++ b/kaldi_seq/src/kaldi_mpe.h @@ -1,7 +1,7 @@ #ifndef NERV_kaldi_KALDI_MPE #define NERV_kaldi_KALDI_MPE -#include "nerv/matrix/matrix.h" -#include "nerv/common.h" +#include "nerv/lib/matrix/matrix.h" +#include "nerv/lib/common.h" #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.3-70-g09d2