Heres the output.
len(dataset.data_grain[0]): 2
len(dataset.data_mask[0]): 2
(dataset.data_grain[0][0]).shape
torch.Size([3, 64, 64])
(dataset.data_mask[0][0]).shape
torch.Size([1, 64, 64])
batchsize: 064

dataset.data_grain[0] is a tuple
I took a look at another example of you, and there was a returning y in the get_item function.
I put it in as well,  and the code worked correct after…
def __getitem__(self, index):
        x_grain, y = self.data_grain[index]
        x_mask, _ = self.data_mask[index]
        x = torch.cat((x_grain, x_mask), dim=0)
        return x, y