W4_Video 3_Doubt in input shape

Do we stack inputs on top of each other or side by side? In previous weeks we were taught that input size is [nx, m] where m is the number of training examples. So if we have 2 inputs, shouldn’t the shape be (1, 2) rather than (2, 1), as shown in the image below?

This image shows that x1 and x2 are stacked on top of each other giving the shape (2, 1).

Hello @DHAiRYA,

Let me start with my interpretation of the slide and see if you have any disagreement.

x_1 and x_2 represents the first and the second features of any sample. Since there are only x_1 and x_2, it means each sample has two features. In (n_x, m), n_x represents the number of features and m, as you said, means the number of training examples.

Since the slide said x has a shape of (2, 1), this means that there is one sample and the sample has two features.

I am not sure about what you mean and what is the difference between “side by side” and “on top of each other”. However, the slide shows that the features are represented in the same Input Layer “side by side”.

Cheers,
Raymond

Got it, you are correct. The (nx, m) shape is for the vectorized form, but here the Prof. was talking about a single example. By side by side I mean each sample represented as 1 column and by ‘on top’ I mean each sample represented as 1 row.

Thank you!

I see. So you are speaking how we arrange the samples in a matrix. You probably have already known the answer by now, but let me just say that it is side by side. :wink:

Cheers,

Raymond