christnp:

It seems I need to convert to PIL and then be sure to include the transforms.


Yes, this would basically recreate the original MNIST __getitem__ method as seen here.
Alternatively, you could also directly call into the __getitem__ from the parent class via:
class TestSubLoader(torchvision.datasets.MNIST):
    '''
    Subloader to extent MNIST dataset
    '''
    def __init__(self, *args, **kwargs):
        super(TestSubLoader, self).__init__(*args, **kwargs)
        
    def __len__(self):
        return len(self.data)
    
    def __getitem__(self, idx):
        return super().__getitem__(idx)

which would yield the same output shapes as the original MNIST dataset.



 christnp:

On to my other concern, is __getitem__ a good place to collect image pairs?


Yes, I think it’s the best place to add this logic to the data loading.
Let me know, if it works for your use case or if you get stuck.