Skip to content

Commit ab393a4

Browse files
authored
Fix double-increment bug in getInts() and getFloats() methods (#156)
1 parent 2681a80 commit ab393a4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo

llm/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/ETImage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ public int[] getInts() {
5151
// the runner expects an int array as input.
5252
int[] intArray = new int[bytes.length];
5353
for (int i = 0; i < bytes.length; i++) {
54-
intArray[i] = (bytes[i++] & 0xFF);
54+
intArray[i] = (bytes[i] & 0xFF);
5555
}
5656
return intArray;
5757
}
5858

5959
public float[] getFloats() {
6060
float[] floatArray = new float[bytes.length];
6161
for (int i = 0; i < bytes.length; i++) {
62-
floatArray[i] = (((bytes[i++] & 0xFF) / 255.0f) - 0.5f) / 0.5f;
62+
floatArray[i] = (((bytes[i] & 0xFF) / 255.0f) - 0.5f) / 0.5f;
6363
}
6464
return floatArray;
6565
}

0 commit comments

Comments
 (0)