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 2019/10/21 22:01:01 UTC

[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16570: [WIP]Showing proper error message when an attempt is made to create large tensor but MXNet is not built with it

access2rohit commented on a change in pull request #16570: [WIP]Showing proper error message when an attempt is made to create large tensor but MXNet is not built with it
URL: https://github.com/apache/incubator-mxnet/pull/16570#discussion_r337259985
 
 

 ##########
 File path: python/mxnet/ndarray/ndarray.py
 ##########
 @@ -155,6 +155,11 @@ def _new_alloc_handle(shape, ctx, delay_alloc, dtype=mx_real_t):
             ctypes.c_int(int(_DTYPE_NP_TO_MX[np.dtype(dtype).type])),
             ctypes.byref(hdl)))
     else:
+        size = 1
+        for idx in shape:
+            size = size * idx
+        if size > 2**32:
+            print("Size of tensor you are trying to allocate is larger than 2^32 elements. Please build with flag USE_INT64_TENSOR_SIZE=1")
 
 Review comment:
   @marcoabreu how to you handle errors in python end? I was looking for existing implementations. Can you point out one ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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