GaussianBlur transform causing error

No other transform is giving me an error but using the GaussianBlur transform gives me this error:

 File "/home/kaustubh/test/basic_augment.py", line 41, in <module>
    main()
  File "/home/kaustubh/test/basic_augment.py", line 34, in main
    transformed_image = data_transforms(image)
  File "/home/kaustubh/Envs/ml/lib/python3.9/site-packages/torchvision/transforms/transforms.py", line 60, in __call__
    img = t(img)
  File "/home/kaustubh/Envs/ml/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/kaustubh/Envs/ml/lib/python3.9/site-packages/torchvision/transforms/transforms.py", line 1730, in forward
    return F.gaussian_blur(img, self.kernel_size, [sigma, sigma])
  File "/home/kaustubh/Envs/ml/lib/python3.9/site-packages/torchvision/transforms/functional.py", line 1238, in gaussian_blur
    t_img = to_tensor(img)
  File "/home/kaustubh/Envs/ml/lib/python3.9/site-packages/torchvision/transforms/functional.py", line 129, in to_tensor
    np.array(pic, mode_to_nptype.get(pic.mode, np.uint8), copy=True)
TypeError: __array__() takes 1 positional argument but 2 were given

Here is the code:

def main():
    data_transforms = transforms.Compose([
        transforms.ToPILImage(),
        transforms.GaussianBlur(kernel_size=(11, 11), sigma=(0.1, 2.0)),
    ])

    im_dir = './test/'
    im_save_dir = './test/'

    for img in tqdm(sorted(os.listdir(im_dir))):
        ext = img.split('.')[1]
        im_name = img.split('.')[0]

        if ext == 'jpg':
            im_path = os.path.join(im_dir, img)

            image = cv2.imread(im_path)
            image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

            transformed_image = data_transforms(image)

if __name__ == "__main__":
    main()

This seems to be the PIL/Pillow issue as described here .