While using RandomAdjustSharpness, my code throws the following error - IndexError: tuple index out of range
Here is my code -
import math, random
from sklearn.datasets import load_sample_images
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autograd
import torch.nn.functional as F
import torchvision.transforms as transforms
import matplotlib.pyplot as plt


def random_crop(imgs):


    imgs = torch.tensor(imgs)
    change = torch.nn.Sequential(
        transforms.RandomCrop(427),
        transforms.RandomAdjustSharpness(1, p=1)
    )
    imgs = change(imgs).numpy()
    return imgs

###Obtaining a random image and preprocessing it!##
dataset = load_sample_images()
first_img_data = dataset.images[0]
first_img_data  = first_img_data.reshape(-1, 427, 640)
first_img_data = first_img_data[1, :, :]
#first_img_data = first_img_data[0:84, 0:84].reshape(-1, 84,84)
# first_img_data = torch.tensor(first_img_data)
plt.figure()
plt.imshow(np.squeeze(first_img_data))

foo = random_crop(first_img_data)
plt.figure()

plt.imshow(np.squeeze(foo))
plt.show()