summaryrefslogtreecommitdiff
path: root/htk_io/init.lua
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-08-26 15:42:43 +0800
committerDeterminant <[email protected]>2015-08-26 15:42:43 +0800
commitb50ec827c6fd7d95375e627a1bedd1236ef02e8c (patch)
tree29fb2fba596259b13f9a04173ff6a795dbc9f303 /htk_io/init.lua
parent6495879e76dc0a2efe7b214b58d1d73a4ed3a931 (diff)
...
Diffstat (limited to 'htk_io/init.lua')
-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