ValueError: could not broadcast input array from shape (10,10) into shape (10,18)
<p>Im using python 3.5 and am attempting a broadcast a 2d list into a 3d list.</p>

<pre><code>ValueError: could not broadcast input array from shape (10,10) into shape (10,18)
</code></pre>

<p>Here is the code I am using that generates the error</p>

<pre><code>v_level =4
M=16
n_down = M/2
n_down0 = M
residual_h_to_2h = np.zeros((v_level,M+2,M+2))
residual_h_to_2h[q][0:n_down+2][0:n_down+2] = restrict(residual_h[0:n_down0+2][0:n_down0+2])
</code></pre>

<p>The shape (0,18) corresponds to residual_h_to_2h. The function restrict returns a list of shape ( (M/2)+2 , (N/2)+2) where (M,N) is the shape of input list. </p>

<p>I am not able to understand why the shape of residual_h_to_2h[q][0:n_down+2][0:n_down+2] is reported as 10,18. It should be 10,10.</p>

<p>I do not seem to be able to resolve this issue on my own. Any help or links to relevant documentation would be greatly appreciated.</p>