summaryrefslogtreecommitdiff
path: root/speech_utils/init.lua
blob: 9e8adba65157689a8ed6469081d5b4fe4ef1bab3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
nerv.speech_utils = {}

function nerv.speech_utils.global_transf(feat_utter, global_transf,
                                        frm_ext, frm_trim, gconf)
    -- prepare for transf
    local input = {feat_utter}
    local output = {feat_utter:create()}
    -- do transf
    global_transf:init(input[1]:nrow())
    global_transf:propagate(input, output)
    -- 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