After loading images with Image.open, I just get the result in (C, H, W, C). How can I change it to (N, C, H, W) in a simple way? Because I find if I use the

trans = transform.Compose([ transforms.Resize((299,299)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])


k = trans(k)

the codes will work. So is there any better way to achieve it?