You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.
The text was updated successfully, but these errors were encountered: