diff options
author | Determinant <[email protected]> | 2015-06-03 23:00:30 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-06-03 23:00:30 +0800 |
commit | a753eca0121ac3ec81ed76bd719d3f1cb9522680 (patch) | |
tree | 9777fdddf5d0404964353a0b3d2821e514f6eeb3 /init.lua | |
parent | 38962683e518dcbebc0cfa6c0c9c9616b25d5bd1 (diff) |
...
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -4,6 +4,8 @@ local TNetReader = nerv.class("nerv.TNetReader", "nerv.DataReader") function TNetReader:__init(global_conf, reader_conf) self.feat_id = reader_conf.id self.frm_ext = reader_conf.frm_ext + self.gconf = global_conf + self.global_transf = reader_conf.global_transf self.feat_repo = nerv.TNetFeatureRepo(reader_conf.scp_file, reader_conf.conf_file, reader_conf.frm_ext) @@ -15,24 +17,26 @@ function TNetReader:__init(global_conf, reader_conf) mlf_spec.dir, mlf_spec.ext) end - self.global_transf = reader_conf.global_transf end function TNetReader:get_data() + if self.feat_repo:is_end() then + return nil + end local res = {} local frm_ext = self.frm_ext local step = frm_ext * 2 + 1 local feat_utter = self.feat_repo:cur_utter() - local expanded = nerv.CuMatrixFloat(feat_utter:nrow(), feat_utter:ncol() * step) - expanded:expand_frm(nerv.CuMatrixFloat.new_from_host(feat_utter), frm_ext) + local expanded = self.gconf.cumat_type(feat_utter:nrow(), feat_utter:ncol() * step) + expanded:expand_frm(self.gconf.cumat_type.new_from_host(feat_utter), frm_ext) local rearranged = expanded:create() rearranged:rearrange_frm(expanded, step) local input = {rearranged} local output = {rearranged:create()} - self.global_transf:init() + self.global_transf:init(input[1]:nrow()) self.global_transf:propagate(input, output) - expanded = nerv.CuMatrixFloat(output[1]:nrow() - frm_ext * 2, output[1]:ncol()) - expanded:copy_fromd(output[1], frm_ext, feat_utter:nrow() - frm_ext) + expanded = self.gconf.mmat_type(output[1]:nrow() - frm_ext * 2, output[1]:ncol()) + output[1]:copy_toh(expanded, frm_ext, feat_utter:nrow() - frm_ext) res[self.feat_id] = expanded for id, repo in pairs(self.lab_repo) do local lab_utter = repo:get_utter(self.feat_repo, expanded:nrow()) |