marcoabreu 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_r338845882
########## File path: python/mxnet/ndarray/ndarray.py ########## @@ -155,6 +155,13 @@ 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**31: + raise Exception("[_new_alloc_handle] Size of tensor you are trying to allocate is " + Review comment: Shall we not just let the backend handle that logic and bubble up the exception? The frontend shouldn't care about these kinds of things I'd say ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services