summaryrefslogtreecommitdiff
path: root/htk_io
diff options
context:
space:
mode:
authorYimmon Zhuang <[email protected]>2015-08-27 13:24:12 +0800
committerYimmon Zhuang <[email protected]>2015-08-27 13:24:12 +0800
commit77084d50207b6078460e83fe6f069967a6e11ccc (patch)
treec7e64fe9669c29825d47ed5b745c559d38090878 /htk_io
parent76d64a91f72a19221e7ff9461860b214cbff216f (diff)
parentb50ec827c6fd7d95375e627a1bedd1236ef02e8c (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'htk_io')
-rw-r--r--htk_io/init.lua26
1 files changed, 25 insertions, 1 deletions
diff --git a/htk_io/init.lua b/htk_io/init.lua
index b836e15..abaa794 100644
--- a/htk_io/init.lua
+++ b/htk_io/init.lua
@@ -29,7 +29,31 @@ function TNetReader:get_data()
end
local res = {}
-- read HTK feature
- local feat_utter = self.feat_repo:cur_utter(self.debug)
+ local raw = self.gconf.cumat_type.new_from_host(self.feat_repo:cur_utter(self.debug))
+ local rearranged
+ if self.frm_ext and self.frm_ext > 0 then
+ local step = self.frm_ext * 2 + 1
+ -- expand the feature
+ local expanded = self.gconf.cumat_type(raw:nrow(), raw:ncol() * step)
+ expanded:expand_frm(raw, self.frm_ext)
+ -- rearrange the feature (``transpose'' operation in TNet)
+ if self.gconf.rearrange then
+ rearranged = expanded:create()
+ rearranged:rearrange_frm(expanded, step)
+ else
+ rearranged = expanded
+ end
+ else
+ rearranged = raw
+ end
+ local feat_utter
+ if self.gconf.frm_trim then
+ feat_utter = self.gconf.mmat_type(rearranged:nrow() - self.gconf.frm_trim * 2, rearranged:ncol())
+ rearranged:copy_toh(feat_utter, self.gconf.frm_trim, rearranged:nrow() - self.gconf.frm_trim)
+ else
+ feat_utter = self.gconf.mmat_type(rearranged:nrow(), rearranged:ncol())
+ rearranged:copy_toh(feat_utter)
+ end
res[self.feat_id] = feat_utter
-- add corresponding labels
for id, repo in pairs(self.lab_repo) do