How can I initialize an empty Numpy array with a given number of dimensions?
<p>I basically want to initialize an empty 6-tensor, like this:</p>

<pre><code>a = np.array([[[[[[]]]]]])
</code></pre>

<p>Is there a better way than writing the brackets explicitly?</p>

<p>You can use <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.empty.html" rel="nofollow">empty</a> or <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html" rel="nofollow">zeros</a>.</p>

<p>For example, to create a new array of 2x3, filled with zeros, use: <code>numpy.zeros(shape=(2,3))</code></p>

python arrays numpy