You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/04/12 20:39:37 UTC

[GitHub] KaiserSozo opened a new issue #10532: NDArray failed to allocate CPU memory

KaiserSozo opened a new issue #10532: NDArray failed to allocate CPU memory
URL: https://github.com/apache/incubator-mxnet/issues/10532
 
 
   Traceback (most recent call last):
     File "SOM.py", line 109, in <module>
       test_som_with_color_data()
     File "SOM.py", line 97, in test_som_with_color_data
       img2 = nd.reshape(weights.data(),shape=(som_dim,som_dim,-1)).asnumpy()
     File "C:\Users\Vitaly\Anaconda2\lib\site-packages\mxnet\ndarray\ndarray.py", line 1868, in asnumpy
       ctypes.c_size_t(data.size)))
     File "C:\Users\Vitaly\Anaconda2\lib\site-packages\mxnet\base.py", line 149, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [15:44:16] d:\program files (x86)\jenkins\workspace\mxnet\mxnet\src\storage\./cpu_device_storage.h:70: Failed to allocate CPU Memory
   
   code:
   
      som_dim = 100
       net = SOMNetwork(input_dim=3, dim=som_dim, sigma=3)
       net.collect_params().initialize(ctx=ctx)
       net.hybridize()
       test_data = nd.random.uniform(0, 1, (5000000, 3))
       weights = net.params.get('weight')
       img1 = nd.reshape(weights.data(), shape=(som_dim,som_dim,-1)).asnumpy()
       plt.figure(1)
       plt.subplot(121)
       plt.imshow(img1)
       start = time.time()
       for i, (data) in enumerate(test_data):
           net.n = i
           data = data.as_in_context(ctx)
           output = net(data)
           weights.set_data(weights.data() + output)
       end = time.time()
       print(end - start)    
       img2 = nd.reshape(weights.data(),shape=(som_dim,som_dim,-1)).asnumpy()
       plt.subplot(122)
       plt.imshow(img2)
       plt.show()
   
   As I understand fails asnumpy function. But as for img1 and for img2 shape of NDArray is 100x100x3.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services