TheOraware:

i noticed my code is not utilising GPU , though i am assigning device as GPU to model as well as dataset


Based on your descriptions, you might be creating bottlenecks in the data processing, so a low GPU utilization might be expected.
Could you remove the GPU usage from the Dataset and profile the “swap” code?
I don’t know how large your tensors are, but it seems you are copying the entire self.features in each call and are also overwriting the previously indexed sample?



 TheOraware:

        sample = self.features[idx, :].copy()
        sample = self.features.copy()