Created
August 31, 2018 12:02
-
-
Save miquelbeltran/6a29ab2fd2f70fe162985c8ac0c5c5a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pass the input data, as an array, that contains a single float array, with a single value | |
// So in all [0][0] = 21, a 1x1 matrix in the form a Array of FloatArray | |
val inp = arrayOf(floatArrayOf(21f)) | |
val inputs = FirebaseModelInputs.Builder().add(inp).build() | |
// Run the model | |
interpreter.run(inputs, dataOptions) | |
.continueWith { task -> | |
try { | |
// The output is also a Array of FloatArray | |
val output = task.result.getOutput<Array<FloatArray>>(0) | |
// Result is in [0][0] | |
Log.d("MainActivity", "Multiplication result: ${output[0][0]}") | |
} catch (t: Throwable) { | |
Log.e("MainActivity", t.localizedMessage, t) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment