Browse Source

!9364 fix java problem

From: @yeyunpeng2020
Reviewed-by: @hangangqiang,@zhanghaibo5
Signed-off-by: @hangangqiang
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
3da8cc98c5
2 changed files with 2 additions and 18 deletions
  1. +0
    -18
      mindspore/lite/java/java/app/src/main/java/com/mindspore/lite/MSTensor.java
  2. +2
    -0
      mindspore/lite/java/java/app/src/main/java/com/mindspore/lite/Model.java

+ 0
- 18
mindspore/lite/java/java/app/src/main/java/com/mindspore/lite/MSTensor.java View File

@@ -80,24 +80,6 @@ public class MSTensor {
return tensorPtr;
}

private float[] decodeBytes(byte[] bytes) {
if (bytes.length % 4 != 0) {
Log.e("MS_LITE", "Length of bytes should be multi of 4 ");
return null;
}
int size = bytes.length / 4;
float[] ret = new float[size];
for (int i = 0; i < size; i = i + 4) {
int accNum = 0;
accNum = accNum | (bytes[i] & 0xff) << 0;
accNum = accNum | (bytes[i + 1] & 0xff) << 8;
accNum = accNum | (bytes[i + 2] & 0xff) << 16;
accNum = accNum | (bytes[i + 3] & 0xff) << 24;
ret[i / 4] = Float.intBitsToFloat(accNum);
}
return ret;
}

private native int[] getShape(long tensorPtr);

private native int getDataType(long tensorPtr);


+ 2
- 0
mindspore/lite/java/java/app/src/main/java/com/mindspore/lite/Model.java View File

@@ -59,6 +59,7 @@ public class Model {
fis.close();
} catch (IOException e) {
Log.e("MS_LITE", "Close file failed");
ret = false;
}
}
if (null != fileDescriptor) {
@@ -66,6 +67,7 @@ public class Model {
fileDescriptor.close();
} catch (IOException e) {
Log.e("MS_LITE", "Close fileDescriptor failed");
ret = false;
}
}
}


Loading…
Cancel
Save