Cannot run NNAPI model with Pytorch 1.8.0 (Access denied finding property "ro.hardware.chipname")

username: ekremcet
cooked: <p>Hi,</p>
<p>I was trying to convert my model for NNAPI support following the tutorial <a href="https://pytorch.org/tutorials/prototype/nnapi_mobilenetv2.html" rel="noopener nofollow ugc">here</a>. It is a basic model with two convolution layers and one PixelShuffle layer. When I just load the traced model and convert it to NNAPI it works and the NNAPI model is saved.</p>
<pre><code class="lang-auto">nnapi_model = torch.backends._nnapi.prepare.convert_model_to_nnapi(traced_model, input_tensor)
</code></pre>
<p>However, when I try to use this model instead of the traced model in my Android application, it throws the following error:</p>
<pre><code class="lang-auto">2021-03-31 10:04:42.408 4895-4895/com.example.pytorchtutorial I/TypeManager: Failed to read /vendor/etc/nnapi_extensions_app_allowlist ; No app allowlisted for vendor extensions use.
2021-03-31 10:04:50.033 4895-4926/com.example.pytorchtutorial I/pytorchtutoria: ProcessProfilingInfo new_methods=513 is saved saved_to_disk=1 resolve_classes_delay=8000
2021-03-31 10:04:56.150 4895-4895/com.example.pytorchtutorial W/Activity: Slow Operation: Activity com.example.pytorchtutorial/.MainActivity onCreate took 14087ms
2021-03-31 10:04:56.163 4895-4895/com.example.pytorchtutorial W/Looper: PerfMonitor longMsg : seq=4 plan=10:04:42.004 late=38ms wall=14118ms running=0ms h=android.app.ActivityThread$H w=159 procState=-1
2021-03-31 10:04:56.163 4895-4895/com.example.pytorchtutorial W/Looper: PerfMonitor looperActivity : package=com.example.pytorchtutorial/.MainActivity time=0ms latency=14159ms running=0ms  procState=-1 ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] } historyMsgCount=2 (msgIndex=2 wall=14118ms seq=4 late=38ms h=android.app.ActivityThread$H w=159)
2021-03-31 10:04:56.177 4895-4928/com.example.pytorchtutorial I/AdrenoGLES-0: QUALCOMM build                   : d360d2f3a8, I3854dcac82
    Build Date                       : 12/14/20
    OpenGL ES Shader Compiler Version: EV031.35.01.01
    Local Branch                     : 
    Remote Branch                    : 
    Remote Branch                    : 
    Reconstruct Branch               : 
2021-03-31 10:04:56.177 4895-4928/com.example.pytorchtutorial I/AdrenoGLES-0: Build Config                     : S P 10.0.7 AArch64
2021-03-31 10:04:56.177 4895-4928/com.example.pytorchtutorial I/AdrenoGLES-0: Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
2021-03-31 10:04:56.179 4895-4928/com.example.pytorchtutorial I/AdrenoGLES-0: PFP: 0x016dc6dc, ME: 0x00000000
2021-03-31 10:04:56.217 4895-4928/com.example.pytorchtutorial E/LB: fail to open file: No such file or directory
2021-03-31 10:05:06.318 4895-4895/com.example.pytorchtutorial E/Assets:: Beauty.png
2021-03-31 10:05:06.318 4895-4895/com.example.pytorchtutorial E/Assets:: Bosphorus.png
2021-03-31 10:05:06.318 4895-4895/com.example.pytorchtutorial E/Assets:: Jockey.png
2021-03-31 10:05:07.929 4895-4895/com.example.pytorchtutorial E/libc: Access denied finding property "ro.hardware.chipname"
</code></pre>
<p>I am using Xiaomi Mi 11 as the test device. <code> E/libc: Access denied finding property "ro.hardware.chipname"</code> error is thrown when I want to run the inference using the model. I wanted to try the code in the tutorial to see if the problem is caused by my model however the nightly build is not available anymore and with the current Pytorch version, tutorial code throws<code> "aten::size" is not supported</code> error.</p>
<p>Any help is appreciated with this. Thanks!</p>

username: Art_Jug
cooked: <p>Hi!</p>
<p>I have the same problem.</p>
<p>Data:<br>
Device:Xiaomi redmi note 9 pro<br>
OS:MIUI Global 12.5.4.0<br>
pytorch_lite version:1.12.1</p>
<p>I am using pytorch_lite lib for inference my yolov5 model. And i have got the same error after executing inference command in line:<br>
<code>val outputTensor = module.forward(IValue.from(inputTensor)).toTensor()</code></p>
<p>I have no idea what to do.</p>