Concatenate along z axis(channel) PyTorch Dataloader

I have a multispectral dataset with 9 bands. Since the data is very large, I split each band to 256 x 256 samples. So I have 16 such samples for each band, and I saved them into different folders(each folder corresponds to each band - so 9 folders). Now how can I concatenate each sample of 9 bands?

For examples, I want to concatenate the 1st sample from the 1st band data with 1st sample of 2nd band, with 1st sample of 3rd band so on, till the 9th band. Then 2nd sample of 1st, 2nd … 9th band. so on till 16th sample.

Please help me to implement it.