Hey, I'm using user define buffer when running the snpe net in my 8350 DSP
.
When I choose an uint8 input buffer and do:
input x in float.
1) x-> (round(255(x-min)/range) , then clamping and casting to uint8
were min and range are taken from dlc (using snpe-dlc-info) after quantizing my net.
and when I insert the input as float I get different results on some images.
How does snpe casting float values to uint8 to run on DSP?
Is it the same as 1) and if so what could cause the difference?
and does the snpe doing the casting in DSP or CPU (the net is running of DSP)
Tnks. Dan
Dear customer,
Regarding the computation for input tenfor from float to fixed point on SNPE, we will get the encoding from model info.
You can look at the sample from snpe sample code for how to compute the float tensor to fixed point.
The sample located at <SNPE_SDK>/examples/NativeCpp/SampleCode.
BR.
Wei
Dear Weihuan
Thanks for your response. As suggested, I looked into the snpe 1.6.0 examples code. I got the quantization info using
snpe->getInputOutputBufferAttributes(name);
When I use user define buffer as uint8 , I load the input buffer map exactly as in the example (the same process of translating float to uint8) but I get a different result (not much but still not bit-exact) compared to using user definer buffer as USERBUFFER_FLOAT.
Both running on DSP .
I load the input map when USERBUFFER_FLOAT.using :
std::memcpy(&applicationBuffers.at(name)[0], input_buf, input_size * sizeof(float));
So my question is when I use snpe->envoke on USERBUFFER_FLOAT. snpe lib does the same computation for me ? and is it in DSP or CPU?
BR , Dan
Dear customer,
The computing behavior is for processing the float for the CPU and DSP both if you input with format of USERBUFFER_FLOAT.
But SNPE will transfer to Fixed point if you run on DSP runtime even you input Float data.
BR.
Wei