train = pd.read_csv('/kaggle/input/digit-recognizer/train.csv')
Data = train.to_numpy()  # Converting to numpy array
n_train = Data.shape[0]  # No of training examples

# Seperating labels and Pixel values from training data
labels = Data[:, 0]     
pixelVal = Data[:, 1:]

# Reshaping Train and test data
pixelVal = np.reshape(pixelVal, [-1, 1, 28, 28]).astype(np.float32())
print('Training:', pixelVal.shape)
train_data, CV_data, train_labels, CV_labels = train_test_split(pixelVal, labels, test_size = 0.1, random_state = 1)
train_data, train_labels, CV_data, CV_labels = map(torch.tensor, (train_data, train_labels, CV_data, CV_labels))

n_train = train_data.shape[0]
n_val = CV_data.shape[0]
r = 345
print(train_labels[r])
image = train_data[r, 0, :, :]
plt.imshow(image, cmap='gray')
plt.axis('off')
plt.show()
transform = transforms.Compose([
    transforms.ToPILImage(),
    transforms.ToTensor()
])
transform_Image = transform(image)
plt.imshow(transform_Image[0], cmap='gray')
plt.axis('off')
plt.show()

You can also search for Digit CNN on Kaggle
https://www.kaggle.com/iamleoab10/digit-cnn 2