Skip to content

Commit 37e17d9

Browse files
update to later tensorflow based on PR reneweb#28 by shokimble
1 parent b964453 commit 37e17d9

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

android/build.gradle

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.0'
8+
classpath 'com.android.tools.build:gradle:2.3.3'
99
}
1010
}
1111

1212
apply plugin: 'com.android.library'
1313

1414
android {
15-
compileSdkVersion 23
16-
buildToolsVersion "26.0.1"
15+
compileSdkVersion 27
16+
buildToolsVersion "27.0.2"
1717

1818
defaultConfig {
1919
minSdkVersion 16
@@ -28,6 +28,9 @@ android {
2828

2929
allprojects {
3030
repositories {
31+
maven {
32+
url 'https://maven.google.com'
33+
}
3134
maven {
3235
// All of React Native (JS, Android binaries) is installed from npm
3336
url "$rootDir/../node_modules/react-native/android"
@@ -38,5 +41,7 @@ allprojects {
3841

3942
dependencies {
4043
compile 'com.facebook.react:react-native:+'
41-
compile 'org.tensorflow:tensorflow-android:1.3.0'
42-
}
44+
compile 'org.tensorflow:tensorflow-android:+'
45+
compile 'com.squareup.okhttp3:okhttp:3.4.1'
46+
compile 'com.android.support:appcompat-v7:22.2.1'
47+
}

android/src/main/java/com/rntensorflow/RNTensorFlowInferenceModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ public void feed(String id, ReadableMap data, Promise promise) {
8989
inference.feed(inputName, Tensor.create(shape, IntBuffer.wrap(srcData)));
9090
} else if(dtype == DataType.BOOL) {
9191
byte[] srcData = readableArrayToByteBoolArray(data.getArray("data"));
92-
inference.feed(inputName, Tensor.create(dtype, shape, ByteBuffer.wrap(srcData)));
92+
inference.feed(inputName, Tensor.create(Boolean.class, shape, ByteBuffer.wrap(srcData)));
9393
} else if(dtype == DataType.STRING) {
9494
byte[] srcData = readableArrayToByteStringArray(data.getArray("data"));
95-
inference.feed(inputName, Tensor.create(dtype, shape, ByteBuffer.wrap(srcData)));
95+
inference.feed(inputName, Tensor.create(String.class, shape, ByteBuffer.wrap(srcData)));
9696
} else {
9797
promise.reject(new IllegalArgumentException("Data type is not supported"));
9898
return;

android/src/main/java/com/rntensorflow/RNTensorflowInference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void run(String[] outputNames, boolean enableStats) {
6464
for (String outputName : outputNames) {
6565
tfContext.runner.fetch(outputName);
6666
}
67-
List<Tensor> tensors = tfContext.runner.run();
67+
List<Tensor<?>> tensors = tfContext.runner.run();
6868

6969
tfContext.outputTensors.clear();
7070
for (int i = 0; i < outputNames.length; i++) {

0 commit comments

Comments
 (0)