aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar freedom" Koan-Sin Tan <koansin.tan@gmail.com>2018-06-04 12:49:17 +0800
committerGravatar Gunhan Gulsoy <gunan@google.com>2018-06-03 21:49:17 -0700
commit320d8056af7799ab20e339757cf379963148425a (patch)
treedbe398df35000d67977d4cbc092d2f06080e7e67
parentd836210e7d7c8bf54676fd4154f40920310cdb27 (diff)
make toco build for android (#17885)
* make toco build for android for ARMv8 ` bazel build --config android_arm64 --cxxopt=-std=c++11 --linkopt="-llog" //tensorflow/contrib/lite/toco:toco --config monolithic ` for ARMv7a ` bazel build --config android_arm --cxxopt=-std=c++11 --linkopt="-llog" //tensorflow/contrib/lite/toco:toco --config monolithic ` * revert out-of-tflite patch will do it in another PR * revert out-of-tflite patch will do it in another PR
-rw-r--r--tensorflow/contrib/lite/toco/toco_port.cc8
-rw-r--r--tensorflow/contrib/lite/toco/toco_port.h18
2 files changed, 26 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/toco/toco_port.cc b/tensorflow/contrib/lite/toco/toco_port.cc
index a1c8696cd0..49a3302caf 100644
--- a/tensorflow/contrib/lite/toco/toco_port.cc
+++ b/tensorflow/contrib/lite/toco/toco_port.cc
@@ -18,6 +18,14 @@ limitations under the License.
#include "tensorflow/contrib/lite/toco/toco_types.h"
#include "tensorflow/core/platform/logging.h"
+#ifdef __ARM_ARCH_7A__
+namespace std {
+double round(double x) {
+ return ::round(x);
+}
+}
+#endif
+
namespace toco {
namespace port {
void CopyToBuffer(const string& src, char* dest) {
diff --git a/tensorflow/contrib/lite/toco/toco_port.h b/tensorflow/contrib/lite/toco/toco_port.h
index 906792ef56..b00b1e89e8 100644
--- a/tensorflow/contrib/lite/toco/toco_port.h
+++ b/tensorflow/contrib/lite/toco/toco_port.h
@@ -33,6 +33,24 @@ limitations under the License.
#define TFLITE_PROTO_NS google::protobuf
#endif
+#ifdef __ANDROID__
+#include <sstream>
+namespace std {
+
+template <typename T>
+std::string to_string(T value)
+{
+ std::ostringstream os ;
+ os << value ;
+ return os.str() ;
+}
+
+#ifdef __ARM_ARCH_7A__
+double round(double x);
+#endif
+}
+#endif
+
namespace toco {
namespace port {