Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

cpp-package predict error at 'int best_idx = predicted.At(0, 0)' whether the ndarray.hpp have a bug? #14732

Closed
abner2015 opened this issue Apr 18, 2019 · 8 comments

Comments

@abner2015
Copy link

The example from

https://github.com/apache/incubator-mxnet/tree/master/cpp-package/example/inference

when i use the cpp package inference the image , occur the error :

vector subscript out of range

at the line :int best_idx = predicted.At(0, 0)
debug code at `ndarray.hpp' :

inline size_t NDArray::Offset(size_t h, size_t w) const { return (h * GetShape()[1]) + w; }
whether hava a bug in ndarray.hpp?

and GetShape()[0] is right?

@frankfliu
Copy link
Contributor

@mxnet-label-bot add [C++, example]

@marcoabreu marcoabreu added C++ Related to C++ Example labels Apr 18, 2019
@leleamol
Copy link
Contributor

@abner2015
Can you please post the error that you are getting after running this example?

@abner2015
Copy link
Author

@leleamol

@abner2015
Can you please post the error that you are getting after running this example?

see content above

@leleamol
Copy link
Contributor

@abner2015 I could not reproduce this issue.The example ran correctly without any errors that you had mentioned.
It would be helpful if you paste the error that you have obtained.

@leleamol
Copy link
Contributor

@mxnet-label-bot add [Pending Requester Info]

@leleamol
Copy link
Contributor

leleamol commented Jun 7, 2019

There is a potential for index out of range. Thanks @abner2015 for pointing this out.
I have created a PR to address this issue.
#15179

@leleamol
Copy link
Contributor

leleamol commented Jun 7, 2019

#15179 is merged.

The issue can be closed.

@zachgk
Copy link
Contributor

zachgk commented Jun 11, 2019

I am closing this issue as it should be resolved as part of #15179. @abner2015, please reopen if the problem persists.

@zachgk zachgk closed this as completed Jun 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants