Placing examples in a mini-batch on the rows or columns of a matrix?
Quoting @ShanqingCai

Putting examples in a batch along the rows of a matrix (i.e., the first axis of the input tensor) is the prevailing way of training deep learning models. Virtually any tensorflow2 / keras example you can find follows that pattern. Putting them along any non-first axis is much rarer.

As said, the row dimension is the preferred way of storing samples. I can think of two reasons why this is the case,

TF does a lot of matrix multiplications involving batches of data. Therefore, by keeping batch dimension as the first dimension, you are able to continuously produce tensors using matrix multiplication, which also has the batch dimension as the first dimension. (e.g. [batch size, 10] . [10, 2] produces [batch size, 2])
The other reason is that the row dimension is the slowest changing dimension. Therefore by you can access an individual sample by taking a single contiguous chunk of memory which is always preferred when it comes to disk reading/ memory reading.
I am using tensorflow 2.0 to train a model. I am deciding about whether I should put multiple examples in a batch along the rows or columns of a matrix. Obviously this will affect how I design the model as well. Is there any practical advice on which is better?