I have a 2D numpy array, say array1
with values. array1
is of dimensions 2x4. I want to create a 4D numpy array array2
with dimensions 20x20x2x4 and I wish to replicate the array array1
to get this array.
That is, if array1
was
[[1, 2, 3, 4],
[5, 6, 7, 8]]
I want
array2[0, 0] = array1
array2[0, 1] = array1
array2[0, 2] = array1
array2[0, 3] = array1
# etc.
How can I do this?