def forward_dct(args, cpc_model, device, data_loader, output_ark, output_scp, dct_dim=24):
    ''' forward with dct '''

    logger.info("Starting Forward Passing")
    cpc_model.eval() # not training cdc model 

    ark_scp_output='ark:| copy-feats --compress=true ark:- ark,scp:' + output_ark + ',' + output_scp 
    with torch.no_grad():
        with ko.open_or_fd(ark_scp_output,'wb') as f:
            for [utt_id, data] in data_loader:
                data = data.float().unsqueeze(1).to(device) # add channel dimension
                data = data.contiguous()
                hidden = cpc_model.init_hidden(len(data))
                output, hidden = cpc_model.predict(data, hidden)
                mat = output.squeeze(0).cpu().numpy() # kaldi io does not accept torch tensor
                dct_mat = fft.dct(mat, type=2, n=dct_dim) # apply dct 
                ko.write_mat(f, dct_mat, key=utt_id[0])
forward with dct
src/forward_pass_v1.py