I want to convert multiple images converted to NumPy to tensor

Is there a library that converts NumPy images with sizes (3158, 224, 224, 3) to tensors of size (3158, 3,224, 224) at once?
How can I convert a size (3158, 224, 224, 3) to a tensor of size (3158, 3,224, 224) at once in a numpy format image?

You won’t be able to use a single operation, but could use torch.from_numpy and either permute the tensor or transpose the numpy array.