Trouble getting started with pytorch mobile

username: Rohan_Sharma1
cooked: <p>I was trying to make an android app for a model I trained and stumbled upon the hello world demo.<br>
I followed the steps and exported my own model (resnet34), and am getting array index out of bounds error.</p>
<pre><code class="lang-auto">Process: org.pytorch.helloworld, PID: 26163
    java.lang.RuntimeException: Unable to start activity ComponentInfo{org.pytorch.helloworld/org.pytorch.helloworld.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=2; index=751
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3121)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3260)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1976)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6912)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=2; index=751
        at org.pytorch.helloworld.MainActivity.onCreate(MainActivity.java:69)
        at android.app.Activity.performCreate(Activity.java:7148)
        at android.app.Activity.performCreate(Activity.java:7139)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1293)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3101)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3260) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1976) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6912) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860) 
</code></pre>
<p>All I did was change the model to my exported model and replaced the <code>IMAGENET_CLASSES</code> array to my array(It has just to elements in it).<br>
If I want to create an android app for my model, what changes do I need to do in the code, and how to begin for a more complex application.</p>

username: vferrer
cooked: <aside class="quote no-group" data-username="Rohan_Sharma1" data-post="1" data-topic="83229">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/rohan_sharma1/48/16483_2.png" class="avatar"> Rohan_Sharma1:</div>
<blockquote>
<p><code>     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=2; index=751</code></p>
</blockquote>
</aside>
<p>I think you had 2 labels (java array has length 2) but you are trying to retrieve label 752 (<code>index=751</code>). So, I think that you aren’t using your custom model. You need to change the model you load. If I remember correctly, It’s in the main activity.</p>

username: Rohan_Sharma1
cooked: <p>For starters I was just changing the model and the IMAGENET_CLASSES array to check how my model performs and then later build my own app as per my requirenments.<br>
I got that error, so I built my own app reffering to the demo and am still getting the same error.<br>
So what changes do I need to do to resolve this issue?</p>