summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2015-08-05 09:29:13 +0800
committerDeterminant <ted.sybil@gmail.com>2015-08-05 09:29:13 +0800
commitc6c644223dc9168befd189bf6f33243390671c99 (patch)
tree554ebb5ad950429d25f9a4e3034dd9418364be85
parent261aed43b863c85ecf709dcac2739c388ec491d2 (diff)
...
-rw-r--r--speech_utils/init.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/speech_utils/init.lua b/speech_utils/init.lua
index 87129af..3d1a470 100644
--- a/speech_utils/init.lua
+++ b/speech_utils/init.lua
@@ -1,13 +1,19 @@
nerv.speech_utils = {}
function nerv.speech_utils.global_transf(feat_utter, global_transf, frm_ext, gconf)
- local step = frm_ext * 2 + 1
- -- expand the feature
- local expanded = gconf.cumat_type(feat_utter:nrow(), feat_utter:ncol() * step)
- expanded:expand_frm(gconf.cumat_type.new_from_host(feat_utter), frm_ext)
- -- rearrange the feature (``transpose'' operation in TNet)
- local rearranged = expanded:create()
- rearranged:rearrange_frm(expanded, step)
+ local rearranged
+ feat_utter = gconf.cumat_type.new_from_host(feat_utter)
+ if frm_ext > 0 then
+ local step = frm_ext * 2 + 1
+ -- expand the feature
+ local expanded = gconf.cumat_type(feat_utter:nrow(), feat_utter:ncol() * step)
+ expanded:expand_frm(feat_utter, frm_ext)
+ -- rearrange the feature (``transpose'' operation in TNet)
+ rearranged = expanded:create()
+ rearranged:rearrange_frm(expanded, step)
+ else
+ rearranged = feat_utter
+ end
-- prepare for transf
local input = {rearranged}
local output = {rearranged:create()}