Difference between revisions of "DeepLearning"

From Hawk Wiki
Jump to: navigation, search
(Created page with "===Deep Learning=== ==Numpy/Python tricks== A trick when you want to flatten a matrix X of shape (a,b,c,d) to a matrix X_flatten of shape (b ∗∗ c ∗∗ d, a) is to use: <...")
 
Line 2: Line 2:
 
==Numpy/Python tricks==
 
==Numpy/Python tricks==
 
A trick when you want to flatten a matrix X of shape (a,b,c,d) to a matrix X_flatten of shape (b ∗∗ c ∗∗ d, a) is to use:
 
A trick when you want to flatten a matrix X of shape (a,b,c,d) to a matrix X_flatten of shape (b ∗∗ c ∗∗ d, a) is to use:
<pre>
+
<pre class="brush:python">
 
X_flatten = X.reshape(X.shape[0], -1).T      # X.T is the transpose of X
 
X_flatten = X.reshape(X.shape[0], -1).T      # X.T is the transpose of X
 
</pre>
 
</pre>

Revision as of 02:32, 8 January 2018

Deep Learning

Numpy/Python tricks

A trick when you want to flatten a matrix X of shape (a,b,c,d) to a matrix X_flatten of shape (b ∗∗ c ∗∗ d, a) is to use:

X_flatten = X.reshape(X.shape[0], -1).T      # X.T is the transpose of X