Since you are using the all data samples at the moment, I think the easiest way would be to split your numpy arrays via sklean.model_selection.train_test_split and transform each split into a tensor with torch.from_numpy.
For the evaluation loop, I would refer to the MNIST example 5.
Note that a Dataset and DataLoader was used in the linked example, but you could simply use the tensors directly as is done in your current code snippet.