How to save the obtained dataset as images and labels

I know that I can use the following methods to obtain training and validation datasets.

testset = torchvision.datasets.CIFAR10(root=’./data’, train=False,
download=True, transform=transform)
testloader =, batch_size=1,
shuffle=False, num_workers=2)

but I now want to divide the verification dataset into two variables, images and labels, and save them as .npy files using What are the possible ways? ?