I’m using a dataset of audio feature vectors (each sample is represented with 40 features). At the moment I create a matrix in the init_ method of my custom dataset and push it to GPU:
self.frame_array_device = torch.from_numpy(self.frame_array)
self.frame_array_device.to(device)

the dataset getitem method is defined as follows:
def __getitem__(self, idx):
        return self.frame_array_device[idx, :]

Samples are drawn by the dataloader:
train_loader = torch.utils.data.DataLoader(
        train_dataset, batch_size=batch_size,shuffle=False)

in the training loop I double check that the features are on the GPU:
batch_features = batch_features.to(device)
However, training is embarassingly slow and CPU usage is at 100%…
I think that there is something wrong, could you give me some hint?
Thanks a lot