Matrix Multiplication code

why we write Matrix A in the shape 1 then transpose it to be in the shape 2, not write it the shape 2 from the beginning? ?

1 Like

Hi @hadeer.awad02, it’s because the convention is we use a row to represent a sample.

This is a matrix algebra example.

In machine learning, sometimes you need a matrix in one shape for one calculation, but need that same matrix in a different shape for a different calculation.

Transposition is an important skill.