5 progname=$(basename "${BASH_SOURCE[0]}")
6 script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7 model2nnpkg=${model2nnpkg:-"$script_dir"/../model2nnpkg/model2nnpkg.sh}
8 # Need to install nncc package & set path to tf2nnpkg
9 tf2nnpkg=$(which tf2nnpkg)
15 echo "Usage: $progname [options] nncc_tc_name"
16 echo "Convert nncc testcase to nnpackage testcase."
19 echo " -h show this help"
20 echo " -i set input directory (default=$indir)"
21 echo " -o set nnpackage testcase output directory (default=$outdir)"
24 echo " model2nnpkg path to model2nnpkg tool (default={this_script_home}/../model2nnpkg)"
27 echo " $progname -i build/compiler/tf2tflite UNIT_Add_000"
28 echo " => create nnpackage testcase in $outdir/ from build/compiler/tf2tflite/UNIT_Add_000.*"
29 echo " $progname -o out UNIT_Add_000"
30 echo " => create nnpackage testcase in out/ using $indir/UNIT_Add_000.*"
35 echo "For help, type $progname -h"
39 while getopts "hi:o:" OPTION; do
51 echo "error: wrong argument (no argument or too many arguments)."
52 echo "For help, type $progname -h"
58 supported_model_types="
67 for ext in $supported_model_types; do
68 [ -e "$indir/$tcname"."$ext" ] && model_type=$ext
71 if [[ "$model_type" == "" ]]; then
72 echo "error: No modelfile is found in $indir/$tcname*"
76 if [[ "$model_type" == "pb" ]]; then
77 [ -f "$indir/$tcname"."v2" ] && tf_intf_version="--v2"
78 $tf2nnpkg --info "$indir/$tcname".info --graphdef "$indir/$tcname"."$model_type" \
79 "$tf_intf_version" -o "$outdir"
81 $model2nnpkg -o "$outdir" "$indir/$tcname"."$model_type"
89 destdir="$outdir/$tcname/metadata/tc"
91 for ext in $extensions; do
92 cp "$indir/$tcname.$ext" "$destdir/$ext"