Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Caffe2] Android NNApi integration bugs. #6868

Open
shashishekhar opened this issue Apr 23, 2018 · 1 comment
Open

[Caffe2] Android NNApi integration bugs. #6868

shashishekhar opened this issue Apr 23, 2018 · 1 comment
Labels

Comments

@shashishekhar
Copy link

Issue description

I found a few bugs in NNApi integration while running benchmarks.

Code example

Bug 1: Invalid size is passed for tensors.
Caffe2 seems to be passing invalid size for tensors in setInput and setOutput.
If I am not wrong, they should be passing tensor->nbytes() instead of tensor->bytes()
https://github.com/caffe2/caffe2/blob/master/caffe2/mobile/contrib/nnapi/nnapi.cc#L659
In ANeuralNetworksExecution_setInput the length parameter is number of bytes, not number of elements in the tensor.
https://developer.android.com/ndk/reference/group___neural_networks.html#gaf5540f8785a31b550ba7e7a78eed6a85

Bug 2: The scale is only supported for Quantized int8 tensors and should be 0 otherwise.
https://github.com/caffe2/caffe2/blob/master/caffe2/mobile/contrib/nnapi/nnapi.cc#L517
NNApi::addTensorOperand should assign scale conditionally.

@zou3519 zou3519 added the caffe2 label Apr 25, 2018
@tingxingdong
Copy link

I am not able to run a nnapi_test either, even with simplest pooling operation. The output dimension is large negative value by print out. So it is may because of the set ouput get wrong. Has the the tensor->nbytes related issue solved?

The new link of file is here
https://github.com/pytorch/pytorch/blob/master/caffe2/mobile/contrib/nnapi/nnapi.cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants