I already did this like
transform = transforms.Compose(
[transforms.ToPILImage(), transforms.ToTensor()])
and  did this
class DatasetProcessing(Dataset):
#initialise the class variables - transform, data, target
def __init__(self, data, target, transform=None): 
    self.transform = transform     
    data = data.view(1, -1)

    self.data =  data
    # converting target to torch.LongTensor dtype
    self.target = target 

#retrieve the X and y index value and return it
def __getitem__(self, index):   
    return (self.transform(self.data[index]), self.target[index])

#returns the length of the data
def __len__(self): 
    return len(list(self.data))