Hi,
Thanks for the reply.
In regards to using  with torch.no_grad(), would this be to avoid storing the intermediate tensors in memory? My current output from x40 is torch.Size([1, 2048, 1, 1]) #batch, features, 1l, 1l , so I assumed the features were being extracted correctly. Also I’m not actually training anything. Before this code I have shown, I have the following code to define the resnet model, where I thought I was already doing this:
resnet50 = models.resnet50(pretrained=True)
    resnet50.to(device)
    for param in resnet50.parameters():
        param.requires_grad = False


I didn’t include this because there is a lot of code to show!
Furthermore, I have checkpoitning put into place where it must be sequential. If the loop breaks, it essentially restarts from the last image that was processed for feature extraction. I am creating a HDF5 dataset that will be used for further training later on. This is why I use a batch size of 1. I was wondering if I could use GPUs to speed up the feature extraction process for weach input without changing the batch size as its position in the table needs to remain the same.
Cheers,