exit 0
}
+USE_TF2CIRCLE=0
+
# Parse command-line arguments
#
while [ "$#" -ne 0 ]; do
export OUTPUT_DIR="$2"
shift 2
;;
+ '--use-tf2circle')
+ USE_TF2CIRCLE=1
+ shift 1
+ ;;
*)
echo "${CUR}"
shift
FILE_BASE=$(basename ${GRAPHDEF_FILE})
MODEL_NAME="${FILE_BASE%.*}"
-export flatc=$(which flatc)
-export tflite_schema="${ROOT}/res/tflite_schema.fbs"
-export circle_schema="${ROOT}/res/circle_schema.fbs"
+if [[ ${USE_TF2CIRCLE} -eq 0 ]]; then
+ export flatc=$(which flatc)
+ export tflite_schema="${ROOT}/res/tflite_schema.fbs"
+ export circle_schema="${ROOT}/res/circle_schema.fbs"
-if ! command_exists $flatc; then
- echo "Please make sure flatc is in path"
- exit 2
+ if ! command_exists $flatc; then
+ echo "Please make sure flatc is in path"
+ exit 2
+ fi
fi
TMPDIR=$(mktemp -d)
trap "{ rm -rf $TMPDIR; }" EXIT
-"${ROOT}/bin/tf2tflite" "${INFO_FILE}" "${GRAPHDEF_FILE}" "${TMPDIR}/${MODEL_NAME}.tflite"
-"${ROOT}/bin/tflite2circle.sh" -o "${TMPDIR}" "${TMPDIR}/${MODEL_NAME}.tflite"
+if [[ ${USE_TF2CIRCLE} -eq 0 ]]; then
+ "${ROOT}/bin/tf2tflite" "${INFO_FILE}" "${GRAPHDEF_FILE}" "${TMPDIR}/${MODEL_NAME}.tflite"
+ "${ROOT}/bin/tflite2circle.sh" -o "${TMPDIR}" "${TMPDIR}/${MODEL_NAME}.tflite"
+else
+ "${ROOT}/bin/tf2circle" "${INFO_FILE}" "${GRAPHDEF_FILE}" "${TMPDIR}/${MODEL_NAME}.circle"
+fi
"${ROOT}/bin/model2nnpkg.sh" -o "${OUTPUT_DIR}" "${TMPDIR}/${MODEL_NAME}.circle"