Getting this while using pytorch transforms--->TypeError: integer argument expected, got float
I cloned transfer-learning-library repo and working on maximum classifier discrepancy. I am trying to change the augmentation but getting the following error
Traceback (most recent call last):
  File &quot;mcd.py&quot;, line 378, in &lt;module&gt;
    main(args)
  File &quot;mcd.py&quot;, line 145, in main
    results = validate(val_loader, G, F1, F2, args)
  File &quot;mcd.py&quot;, line 290, in validate
    for i, (images, target) in enumerate(val_loader):
  File &quot;/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py&quot;, line 521, in __next__
    data = self._next_data()
  File &quot;/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py&quot;, line 1203, in _next_data
    return self._process_data(data)
  File &quot;/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py&quot;, line 1229, in _process_data
    data.reraise()
  File &quot;/usr/local/lib/python3.7/dist-packages/torch/_utils.py&quot;, line 425, in reraise
    raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File &quot;/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py&quot;, line 287, in _worker_loop
    data = fetcher.fetch(index)
  File &quot;/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py&quot;, line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File &quot;/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py&quot;, line 44, in &lt;listcomp&gt;
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File &quot;../../../common/vision/datasets/imagelist.py&quot;, line 48, in __getitem__
    img = self.transform(img)
  File &quot;/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py&quot;, line 60, in __call__
    img = t(img)
  File &quot;/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py&quot;, line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File &quot;/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py&quot;, line 750, in forward
    return F.perspective(img, startpoints, endpoints, self.interpolation, fill)
  File &quot;/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional.py&quot;, line 647, in perspective
    return F_pil.perspective(img, coeffs, interpolation=pil_interpolation, fill=fill)
  File &quot;/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional_pil.py&quot;, line 289, in perspective
    return img.transform(img.size, Image.PERSPECTIVE, perspective_coeffs, interpolation, **opts)
  File &quot;/usr/local/lib/python3.7/dist-packages/PIL/Image.py&quot;, line 2371, in transform
    im = new(self.mode, size, fillcolor)
  File &quot;/usr/local/lib/python3.7/dist-packages/PIL/Image.py&quot;, line 2578, in new
    return im._new(core.fill(mode, size, color))
TypeError: integer argument expected, got float

The previous code was
 # Data loading code
    normalize = T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
    if args.center_crop:
        train_transform = T.Compose([
            ResizeImage(256),
            T.CenterCrop(224),
            T.RandomHorizontalFlip(),
            T.ToTensor(),
            normalize
        ])
    else:
        train_transform = T.Compose([
            ResizeImage(256),
            T.RandomResizedCrop(224),
            T.RandomHorizontalFlip(),
            T.ToTensor(),
            normalize
        ])
    val_transform = T.Compose([
        ResizeImage(256),
        T.CenterCrop(224),
        T.ToTensor(),
        normalize
    ])

I just added  T.RandomPerspective(distortion_scale = 0.8, p=0.5, fill=0.6) for val_transform.
Before this I also added few other transforms for train_transform but still got the same error.
What could be the problem?

The fill argument needs to be an integer.
This transform does not support the fill parameter for Tensor types; therefore, if you wish to use the fill parameter, then you must use this transform before the ToTensor transform. At this point, the data is integral.
