blob: 0b65edc4e52560de07e94e08068520c4cb77f598 (
plain) (
tree)
|
|
nerv.speech_utils = {}
function nerv.speech_utils.global_transf(feat_utter, network,
frm_ext, frm_trim, gconf)
-- prepare for transf
local input = {feat_utter}
local output = {feat_utter:create()}
-- do transf
local batch_size = input[1]:nrow()
network:mini_batch_init({seq_length = table.vector(batch_size, 1),
new_seq = {},
do_train = false,
input = {input},
output = {output}})
network:propagate()
-- trim frames
if gconf.use_cpu then
mat_type = gconf.mmat_type
else
mat_type = gconf.cumat_type
end
expanded = mat_type(output[1]:nrow() - frm_trim * 2, output[1]:ncol())
expanded:copy_from(output[1], frm_trim, feat_utter:nrow() - frm_trim)
collectgarbage("collect")
return expanded
end
|