Hi,
I am trying to learn PyTorch. So, I started with MNIST Digit Recognition. I am using the CSV  dataset file.
I wanted to write my program using functions. Like, I call to def load_test_data and the output of this function must be the processed train images and labels.
After, loading the CSV file into a panda framework I converted it into NumPy and tensor respectively. But, as a newcomer, when I am trying to use transforms it is giving different types of errors. I have searched Google, StackOverflow, and PyTorch Forum and found that I have to create own class to transform. It seems difficult to me!
Is there any way to do transforms and DataLoader for my code?
def load_train_data():
    # Loding CSV file in a dataframe with values
    train_img_df = pd.read_csv(os.path.join(config.dataset_path(), "mnist_train.csv"))
    
    #Getting image pixels values and labels from dataset 
    train_images = train_img_df.iloc[:, 1:]
    train_images = train_images.to_numpy()
    train_images = train_images.reshape((-1, 1, 28, 28))
    train_images = torch.tensor(train_images)
    print(train_images.shape) #torch.Size([42000, 1, 28, 28])
    
    train_labels = train_img_df.iloc[:, 0]
    train_labels = train_labels.to_numpy()
    train_labels = train_labels.reshape(train_labels.shape[0], 1)
    train_labels = torch.tensor(train_labels)
    print(train_labels.shape) #torch.Size([42000, 1])
    
    
    transformations=torchvision.transforms.Compose([torchvision.transforms.ToTensor()])
    #What I have to write in here to transform and for DataLoader
    train_images = ???
    
    #Trying to creat  Dataloder
    train_img_loader = torch.utils.data.DataLoader(train_images, batch_size= config.batch_size)
    train_lab_loader = torch.utils.data.DataLoader(train_labels, batch_size= config.batch_size)