How Do I Fix This Memoryerror For A Large Array
I am getting this error in my code: MemoryError: Unable to allocate 10.5 GiB for an array with shape (61, 17, 41, 59, 51, 11) and data type float64 When I try to run my code at #Co
Solution 1:
the problem is that your memory usage exceeds your available memory. you should try to optimize your memory usage. for example the default data type for np.array is float64. you can save lot of memory with changing your code to
backtopspin=np.empty(((61),(17),(41),(59),(51),(11)), dtype=np.float32)
sidespin=np.empty(np.shape(backtopspin), dtype=np.float32)
here you can read more about python data types to select the one which suits your needs the best.
if even that is not enough try using less samples and lowering your array dimensions.
Post a Comment for "How Do I Fix This Memoryerror For A Large Array"