The reason is that the data
property of your result in apply_tfms is not a torch.Tensor.
def apply_tfms(self, tfms, *args, **kwargs):
self.img1 = self.img1.apply_tfms(tfms, *args, **kwargs)
self.img2 = self.img2.apply_tfms(tfms, *args, **kwargs)
self.data = [self.img1.data, self.img2.data] # This should be a tensor...
return self
Take a look at @baz great thread on that:
From his code: https://github.com/mogwai/fastai_audio/blob/voice-rec/Voice%20Identification.ipynb
...
def apply_tfms(self, tfms):
for tfm in tfms:
self.data = torch.stack([tfm(x) for x in self.data])
return self
...