TypeError: 'NoneType' object is not callable for transform functional

Hi,
I have been trying to upload and transform images for training. I get the following error. Initially I thought that images were not getting uploaded but upon printing them they seem to be getting uploaded. So what can be the reason for the error ? Here is the output that I get -

/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py:211: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
“please use transforms.Resize instead.”)
Saving in dir: /prj/neo_lv/user/debadas/ProtoTransfer/cdfsl-benchmark/logs/checkpoints/miniImagenet/ResNet10_prototransfer_1s_3q_aug_bs50
<PIL.Image.Image image mode=RGB size=280x280 at 0x7F9E105AAE48>
<PIL.Image.Image image mode=RGB size=500x333 at 0x7F9E105AA470>
<PIL.Image.Image image mode=RGB size=500x375 at 0x7F9E105AA128>
<PIL.Image.Image image mode=RGB size=1070x782 at 0x7F9E1059BC88>
<PIL.Image.Image image mode=RGB size=288x271 at 0x7F9E105AA7B8>
<PIL.Image.Image image mode=RGB size=334x500 at 0x7F9E105AA080>
<PIL.Image.Image image mode=RGB size=500x417 at 0x7F9E105A3DA0>
<PIL.Image.Image image mode=RGB size=500x375 at 0x7F9E1059B9B0>
<PIL.Image.Image image mode=RGB size=679x705 at 0x7F9E105AA550>
<PIL.Image.Image image mode=RGB size=360x252 at 0x7F9E105AABA8>
<PIL.Image.Image image mode=RGB size=500x375 at 0x7F9E105AAB00>
<PIL.Image.Image image mode=RGB size=400x300 at 0x7F9E105A3A58>
Traceback (most recent call last):
File “/prj/neo_lv/user/debadas/ProtoTransfer/cdfsl-benchmark/train.py”, line 104, in
<PIL.Image.Image image mode=RGB size=500x375 at 0x7F9E105AA128>
model = train(base_loader, model, optimization, start_epoch, stop_epoch, params)
File “/prj/neo_lv/user/debadas/ProtoTransfer/cdfsl-benchmark/train.py”, line 31, in train
model.train_loop(epoch, base_loader, optimizer)
File “/prj/neo_lv/user/debadas/ProtoTransfer/cdfsl-benchmark/methods/protoclr.py”, line 72, in train_loop
for i, x in enumerate(train_loader):
File “/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py”, line 582, in next
return self._process_next_batch(batch)
File “/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py”, line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
TypeError: Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py”, line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File “/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py”, line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File “/prj/neo_lv/user/debadas/ProtoTransfer/cdfsl-benchmark/datasets/miniImageNet_few_shot.py”, line 61, in getitem
view_list.append(self.transform(data).unsqueeze(0))
File “/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py”, line 61, in call
img = t(img)
TypeError: ‘NoneType’ object is not callable

Hi, Could you share the way you constructed self.transform ?

PS: It helps a lot if you could wrap your code in ``` like this, it enhaces readability:

```
code/error
```

Bests