Tensorflow protobuf files built with protobuf version 3.2.0 and used in
building tensorflow network models in armnn.

Signed-off-by: Qin Su <q...@ti.com>
---
 .../armnn-tensorflow/armnn-tensorflow.bb           | 22 +++++++
 .../generate_tensorflow_protobuf.sh                | 73 ++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 
meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow.bb
 create mode 100644 
meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow/generate_tensorflow_protobuf.sh

diff --git 
a/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow.bb 
b/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow.bb
new file mode 100644
index 0000000..514b363
--- /dev/null
+++ b/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow.bb
@@ -0,0 +1,22 @@
+DESCRIPTION = "Tensorflow protobuf files - used in ARMNN for Tensorflow 
network models"
+LICENSE = "Apache"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=01e86893010a1b87e69a213faa753ebd"
+
+SRC_URI = " \
+    git://github.com/tensorflow/tensorflow.git \
+    file://generate_tensorflow_protobuf.sh;subdir=${S} \
+"
+
+SRCREV = "aed8f42bafabf11c5d92ce4109a5e0408b31f9c5"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+        install -d ${D}${datadir}/${PN}
+               chmod +x ${S}/generate_tensorflow_protobuf.sh
+       ${S}/generate_tensorflow_protobuf.sh ${D}${datadir}/${PN} 
+}
+
+PACKAGES =+ "${PN}-source"
+FILES_${PN}-source = "${datadir}/${PN}"
+
diff --git 
a/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow/generate_tensorflow_protobuf.sh
 
b/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow/generate_tensorflow_protobuf.sh
new file mode 100644
index 0000000..52c1827
--- /dev/null
+++ 
b/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow/generate_tensorflow_protobuf.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# Copyright © 2017 Arm Ltd. All rights reserved.
+# See LICENSE file in the project root for full license information.
+#
+
+THIS_SCRIPT=$0
+OUTPUT_DIR=$1
+PROTOBUF_INSTALL_DIR=$2
+
+usage()
+{
+  echo
+  echo "Usage: ${THIS_SCRIPT} <OUTPUT_DIR> [PROTOBUF_INSTALL_DIR]"
+  echo
+  echo "  <OUTPUT_DIR> is the location where the generated files will be 
placed"
+  echo "  [PROTOBUF_INSTALL_DIR] the location of the protobuf installation"
+  echo
+}
+
+if [ "x$OUTPUT_DIR" = "x" ]
+then
+  usage
+  exit 1
+fi
+
+mkdir -p ${OUTPUT_DIR}
+ERR=$?
+if [ $ERR -ne 0 ]
+then
+  echo
+  echo "Cannot create output dir: ${OUTPUT_DIR}"
+  echo "mkdir returned: $ERR"
+  echo
+  usage
+  exit 1
+fi
+
+
+if [ "x${PROTOBUF_INSTALL_DIR}" = "x" ]
+then
+  PROTOBUF_INSTALL_DIR=/usr/local
+fi
+
+if [ ! -x "${PROTOBUF_INSTALL_DIR}/bin/protoc" ]
+then
+  echo
+  echo "No usable protocol buffer (protoc) compiler found in 
${PROTOBUF_INSTALL_DIR}/bin/"
+  echo "You can specify the location of the protobuf installation as the 
second"
+  echo "argument of ${THIS_SCRIPT}."
+  usage
+  exit 1
+fi
+
+
+TF_PROTO_FILES=tensorflow/contrib/makefile/tf_proto_files.txt
+if [ -r $TF_PROTO_FILES ]
+then
+  OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+  for i in `cat $TF_PROTO_FILES`
+  do
+    LD_LIBRARY_PATH=$OLD_LD_LIBRARY_PATH:${PROTOBUF_INSTALL_DIR}/lib \
+    $PROTOBUF_INSTALL_DIR/bin/protoc $i \
+      --proto_path=. \
+      --proto_path=${PROTOBUF_INSTALL_DIR}/include \
+      --cpp_out $OUTPUT_DIR
+  done
+else
+  echo "Couldn't find $TF_PROTO_FILES. This script should be run from the"
+  echo "tensorflow source directory."
+  exit 1
+fi
+
-- 
1.9.1

_______________________________________________
meta-arago mailing list
meta-arago@arago-project.org
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago

Reply via email to