-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Showing proper error message when an attempt is made to create large tensor but MXNet is not built with it #16570
Conversation
@mxnet-label-bot add [pr-work-in-progress] |
9593e8b
to
9e2fbea
Compare
9e2fbea
to
81bef22
Compare
05c8ac1
to
d035559
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to also add some tests?
@marcoabreu I definitely will. But I need to make sure the functionality works fine first. |
Sure, sorry for asking prematurely |
@@ -272,10 +272,22 @@ inline bool InitShape(const nnvm::NodeAttrs& attrs, | |||
CHECK_EQ(in_attrs->size(), 0U); | |||
CHECK_EQ(out_attrs->size(), 1U); | |||
mxnet::TShape param_shape = param.shape; | |||
if (shape_is_known(param_shape) && !features::is_enabled(features::INT64_TENSOR_SIZE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not directly check the compiler flag here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer that way - looks cleaner :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in certain cases shape is not know at the beginning, then param_shape.Size() throws a different error, which is not a good user experience. That's why this check is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apeforest @marcoabreu do you think this makes sense now ?
bf57e72
to
c9c8bb4
Compare
@mxnet-label-bot add [pr-awaiting-review] |
@apeforest @ChaiBapchya @zheng-da @marcoabreu This PR is ready for review |
bbd0b30
to
cf7dc07
Compare
40cf110
to
c8f28e0
Compare
…ser attempts to pass large ndarrays as inputs to operators or large shape of inputs for memory allocation.
This reverts commit d035559.
c8f28e0
to
2a7e027
Compare
…tensor but MXNet is not built with it (apache#16570) * added error message when creating NDarray and syncing copies to and from CPU * bug fix for 1>>31 -> uint32_t{1}<<31 and showing error message when user attempts to pass large ndarrays as inputs to operators or large shape of inputs for memory allocation. * adding error messages to other operators where user can create NDArray indirectly * bug fix * removing additional checks * Revert "removing additional checks" This reverts commit d035559. * adding tests and comments. Removed int64 check from linspace
Description
Throwing error message to customers that they need to build MXNet with flag USE_INT64_TENSOR_SIZE=1 when user attempts to create large NDarrays for e.g.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Testing