Imported Upstream version 1.8.0
[platform/core/ml/nnfw.git] / compiler / one-cmds / one-quantize
index ff9e266..c74b2c2 100644 (file)
@@ -22,16 +22,23 @@ usage()
 {
   echo "Quantize circle model."
   echo "Usage: one-quantize"
+  echo "    --version         Show version information and exit"
   echo "    --input_dtype     Input data type (supported: float32, default=float32)"
   echo "    --quantized_dtype Output quantized data type (supported: uint8, default=uint8)"
-  echo "    --granularity     Quantize granularity (supported: layer, default=layer)"
+  echo "    --granularity     Quantize granularity (supported: layer, channel, default=layer)"
   echo "    --min_percentile  Minimum percentile (0.0~100.0, default=1.0)"
   echo "    --max_percentile  Maximum percentile (0.0~100.0, default=99.0)"
   echo "    --mode            Record mode (supported: percentile/moving_average, default=percentile)"
   echo "    --input_path <path/to/input/circle>"
   echo "    --input_data <path/to/input/data>"
   echo "    --output_path <path/to/output/circle>"
-  exit 0
+  exit 255
+}
+
+version()
+{
+  $DRIVER_PATH/one-version one-quantize
+  exit 255
 }
 
 INPUT_DTYPE=float32
@@ -50,6 +57,9 @@ while [ "$#" -ne 0 ]; do
     '--help')
       usage
       ;;
+    '--version')
+      version
+      ;;
 
     '--input_dtype')
       INPUT_DTYPE="$2"
@@ -100,13 +110,11 @@ if [ -z ${INPUT_PATH} ] || [ ! -e ${INPUT_PATH} ]; then
   echo "Error: input model not found"
   echo ""
   usage
-  exit 2
 fi
 if [ -z ${INPUT_DATA} ] || [ ! -e ${INPUT_DATA} ]; then
   echo "Error: input data not found"
   echo ""
   usage
-  exit 2
 fi
 
 FILE_BASE=$(basename ${OUTPUT_PATH})
@@ -118,6 +126,13 @@ trap "{ rm -rf $TMPDIR; }" EXIT
 # remove previous log
 rm -rf "${OUTPUT_PATH}.log"
 
+show_err_onexit()
+{
+  cat "${OUTPUT_PATH}.log"
+}
+
+trap show_err_onexit ERR
+
 # quantize circle
 echo "${DRIVER_PATH}/circle-quantizer" \
 --quantize_dequantize_weights ${INPUT_DTYPE} ${QUANTIZED_DTYPE} ${GRANULARITY} \