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:17:03 UTC

[GitHub] [incubator-mxnet] leezu 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

leezu 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_r337264847
 
 

 ##########
 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:
 
 Review comment:
   This also happens for `size < 2**32`. For example with the matrix of shape `(18545452, 200)` in https://github.com/dmlc/gluon-nlp/issues/981.
   
   Please make the check more accurate

----------------------------------------------------------------
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