np.expand_dims() is used in C2W3L1.

The numpy doc:

Can someone help me understand what does this axis parameter mean?

When axis = 0,1,(0,1),(2,0)……. What happens there?

np.expand_dims() is used in C2W3L1.

The numpy doc:

Can someone help me understand what does this axis parameter mean?

When axis = 0,1,(0,1),(2,0)……. What happens there?

Hello @Jinyan_Liu,

I need you to just focus on these three examples,

and answer the following:

- Comparing the 2nd and the 3rd example to the 1st example, try to describe their changes in their shapes (pointed out by green arrows)
- try to explain the above change by the setting of the
`axis`

parameters (underlined in red)

Reading numpy doc is a daily thing, and many of us are not familiar with that at first, but take your time, read and think carefully, and try to answer the above two questions.

For the first question, **focus on describing the change**. For the second question, **focus on how you may connect the difference in the settings to the difference in the changes**.

Good luck!

Raymond

When axis = 0, we are trying to expand a “row” dim, and when axis = 1, we are trying to expand a “column” dim?

But I couldn’t find anything that can connect to the tuple axis. What does (2,0) mean?

Example 2 and 3 printed the shapes for you. What would you do if example 4 and 5 didn’t print it for you? I would add a print statement, run it, and see it for myself.

1 Like

Thanks!

It’s (1,1,2) and (1,2,1)!

Is axis = (2,0) the same as axis=(0,2) then?

That’s a good question! Maybe you can give it a try?

1 Like

Thank you so much!

It’s the same.

Now I know how to understand numpy doc by trying it out myself.

Thank you so much for your leading and patience along the way!