Implement LSH Projection for NN API on CPU
Bug: 63905942
Adapted previous TF Lite implementation and unit tests.
Test: adb shell /data/nativetest/lsh_projection_test/lsh_projection_test
Change-Id: Id90192becfec11a658d57495831327dbb380fc0a
diff --git a/common/Android.bp b/common/Android.bp
index e4fb7f7..c3a2a0c 100644
--- a/common/Android.bp
+++ b/common/Android.bp
@@ -29,6 +29,7 @@
srcs: [
"CpuExecutor.cpp",
+ "LSHProjection.cpp",
"OperationsUtils.cpp",
"RNN.cpp",
"Utils.cpp",
@@ -48,6 +49,7 @@
"libhidltransport",
"libhidlmemory",
"liblog",
+ "libtextclassifier_hash",
"libutils",
"[email protected]",
"[email protected]",
@@ -58,10 +60,12 @@
"libgemmlowp",
"libfixedpoint",
"libeigen",
+ "libtextclassifier_hash_headers",
],
cflags: [
+ "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash",
"-Werror",
"-Wall",
"-Wextra",
@@ -72,15 +76,35 @@
}
cc_test {
- name: "rnn_test",
+ name: "lsh_projection_test",
srcs: [
- "RNNTest.cpp",
- ],
- shared_libs: [
- "libneuralnetworks",
+ "LSHProjectionTest.cpp",
],
static_libs: [
"libgmock",
"libneuralnetworks_common",
],
+ header_libs: [
+ "libneuralnetworks_headers",
+ ],
+ shared_libs: [
+ "libneuralnetworks",
+ ],
+}
+
+cc_test {
+ name: "rnn_test",
+ srcs: [
+ "RNNTest.cpp",
+ ],
+ static_libs: [
+ "libgmock",
+ "libneuralnetworks_common",
+ ],
+ header_libs: [
+ "libneuralnetworks_headers",
+ ],
+ shared_libs: [
+ "libneuralnetworks",
+ ],
}