First I initialize a matrix called A with finite dimensions. While I try to assign values to matrix A as shown in the code, the process takes more and more RAM. I guess it is internally creating some temporary variables and not freeing up the memory once the assignment is done for a single iteration. Over time the process reaches the limit of my RAM (i.e. 32 GB) and my computer starts hanging. Can someone please comment on this problem? Is there a better way to do the following task?
import numpy as np
A = np.zeros((10000, 200, 3000))
for i in range(A.shape[0]):
print(i)
A[i,:,:] = np.random.rand(A.shape[1], A.shape[2])