Return the tensor part from the generator class


I am using this command to read the ark.files
train_feat = torchaudio.kaldi_io.read_mat_ark(’/home/mnabih/kaldi/egs/timit/s5/mfcc/cmvn_train.ark’)
The output type is Generator [(str, torch.Tensor)]
How can I extract the tensor part only to train my network.
d = {u: d for u, d in torchaudio.kaldi_io.read_mat_ark(’/home/mnabih/kaldi/egs/timit/s5/mfcc/cmvn_train.ark’)}

it gives me class with key: string and value: torch.tensor
I want to remove the key and using the tensor to train my network

Have you tried?

g = torchaudio.kaldi_io.read_mat_ark(’/home/mnabih/kaldi/egs/timit/s5/mfcc/cmvn_train.ark’)

d = {u: d for u, d in g}  # dictionary
t = [d for _, d in g]  # list of tensors