# Dimensions of array

**URL:** <https://community.deeplearning.ai/t/dimensions-of-array/10790>\
**Category:** Improving Deep Neural Networks: Hyperparameter tun\
**Tags:** coursera-platform\
**Created:** [June 1, 2021, 1:42am UTC](https://community.deeplearning.ai/t/dimensions-of-array/10790 "2021-06-01T01:42:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nahammond](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/nahammond/32/1288_2.png) [@Nahammond](https://community.deeplearning.ai/u/Nahammond)\
**Post date:** [June 1, 2021, 1:42am UTC](https://community.deeplearning.ai/t/dimensions-of-array/10790/1 "2021-06-01T01:42:41Z")

</div>

Trouble with matrix dimensions  
row is shape[1] = nx = 64  
col is shape[0] = m = 209

I need to reshape training\_set\_orig (209,64,64,3)  
to training\_set\_flatten to (12288,209) This means 64 X 64 X 3=12288 cols and 209 rows?

Im used to matrix dem A = A(rows, cols) =A(64,209) so I get mixed up here

My code doesn’t work:  
train\_setx\_flatten = train\_set\_x\_orig.reshape(train\_set\_x\_orig.shape[0],train\_set\_x\_orig.shape[1]\*train\_set\_x\_orig.shape[1]\*3,-1).T  
test\_set\_x\_flatten = test\_set\_x\_orig.reshape(test\_set\_x\_orig.shape[0],test\_set\_x\_orig.shape[1]\*test\_set\_x\_orig.shape[1]\*3,-1).T

Error message: AssertionError: Wrong solution. Use (X.shape[0], -1).T.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [June 1, 2021, 3:08am UTC](https://community.deeplearning.ai/t/dimensions-of-array/10790/3 "2021-06-01T03:08:41Z")

</div>

I forget which exercise in Course 2 has those dataset dimensions, but it sounds like the dataset used in Course 1 Week 2 and Week 4. [Here’s a thread](https://community.deeplearning.ai/t/flattening-images-in-the-logistic-regression-assignment-in-course-1-week-2/149) which discusses why the “flatten” logic works the way it does.
