'How to convert list of images to batchxheightxwidthxchannel format shape?

I have a list of images each with shape=(20, 20, 1), there are 10 images so len(list)=10.

How can I convert this into tensor/array with shape=(10,20,20,1)?

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source