diff --git a/compiler/one-cmds/CMakeLists.txt b/compiler/one-cmds/CMakeLists.txt index 2e43fce4faa..99df414cd44 100644 --- a/compiler/one-cmds/CMakeLists.txt +++ b/compiler/one-cmds/CMakeLists.txt @@ -51,6 +51,7 @@ set(ONE_COMMAND_FILES one-import-tf one-import-tflite one-import-onnx + one-resize one-optimize one-quantize one-pack diff --git a/compiler/one-cmds/one-build b/compiler/one-cmds/one-build index 556a8f85eb9..984545a5b8d 100644 --- a/compiler/one-cmds/one-build +++ b/compiler/one-cmds/one-build @@ -79,6 +79,7 @@ def _get_driver_name(driver_name): 'one-import-tf': 'one-import-tf', 'one-import-tflite': 'one-import-tflite', 'one-import-onnx': 'one-import-onnx', + 'one-resize': 'one-resize', 'one-optimize': 'one-optimize', 'one-quantize': 'one-quantize', 'one-partition': 'one-partition', @@ -154,8 +155,8 @@ def main(): bin_dir = os.path.dirname(os.path.realpath(__file__)) import_drivers_dict = oneutils.detect_one_import_drivers(bin_dir) transform_drivers = [ - 'one-optimize', 'one-quantize', 'one-pack', 'one-codegen', 'one-profile', - 'one-partition' + 'one-resize', 'one-optimize', 'one-quantize', 'one-pack', 'one-codegen', + 'one-profile', 'one-partition' ] _verify_cfg(import_drivers_dict, config) diff --git a/compiler/one-cmds/one-build.template.cfg b/compiler/one-cmds/one-build.template.cfg index 42960811ef3..583c84e180f 100644 --- a/compiler/one-cmds/one-build.template.cfg +++ b/compiler/one-cmds/one-build.template.cfg @@ -3,6 +3,7 @@ one-import-tf=True one-import-tflite=False one-import-bcq=False one-import-onnx=False +one-resize=False one-optimize=True one-quantize=False one-parition=False diff --git a/compiler/one-cmds/one-resize b/compiler/one-cmds/one-resize new file mode 100644 index 00000000000..0064490b806 --- /dev/null +++ b/compiler/one-cmds/one-resize @@ -0,0 +1,128 @@ +#!/usr/bin/env bash +''''export SCRIPT_PATH="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)" # ''' +''''export PY_PATH=${SCRIPT_PATH}/venv/bin/python # ''' +''''test -f ${PY_PATH} && exec ${PY_PATH} "$0" "$@" # ''' +''''echo "Error: Virtual environment not found. Please run 'one-prepare-venv' command." # ''' +''''exit 255 # ''' + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import configparser +import os +import sys + +import onelib.utils as oneutils + +# TODO Find better way to suppress trackback on error +sys.tracebacklimit = 0 + + +def _get_parser(): + parser = argparse.ArgumentParser( + description='command line tool to change shape of model inputs') + + oneutils.add_default_arg(parser) + + ## model2nnpkg arguments + model2nnpkg_group = parser.add_argument_group('arguments for packaging') + + model2nnpkg_group.add_argument('-i', + '--input_path', + type=str, + help='Path to the input model (.circle)') + + model2nnpkg_group.add_argument('-o', + '--output_path', + type=str, + help='Path to the resized model (.circle)') + + model2nnpkg_group.add_argument( + '-s', + '--input_shapes', + type=str, + help= + 'New inputs shapes in in comma separated format. An example for 2 inputs: [1,2],[3,4].' + ) + + return parser + + +def _parse_arg(parser): + args = parser.parse_args() + # print version + if args.version: + oneutils.print_version_and_exit(__file__) + + return args + + +def _verify_arg(parser, args): + """verify given arguments""" + # check if required arguments is given + missing = [] + if not oneutils.is_valid_attr(args, 'input_path'): + missing.append('input_path') + if not oneutils.is_valid_attr(args, 'output_path'): + missing.append('output_path') + if not oneutils.is_valid_attr(args, 'input_shapes'): + missing.append('input_shapes') + if len(missing): + parser.error('The following arguments are required: ' + ' '.join(missing)) + return + + +def _resize(args): + bin_path = os.path.dirname(os.path.realpath(__file__)) + cur_path = os.getcwd() + input_path = os.path.join(cur_path, args.input_path) + output_path = os.path.join(cur_path, args.output_path) + log_file_path = os.path.join(cur_path, output_path) + '.log' + + with open(log_file_path, 'wb', buffering=0) as f: + circle_resizer_path = os.path.join(bin_path, 'circle-resizer') + + cmd = [os.path.expanduser(circle_resizer_path)] + + cmd.append('--input_path') + cmd.append(input_path) + cmd.append('--output_path') + cmd.append(output_path) + cmd.append('--input_shapes') + cmd.append(args.input_shapes) + + f.write((' '.join(cmd) + '\n').encode()) + + # run circle-resizer + oneutils.run(cmd, err_prefix='one-resize', logfile=f) + + +def main(): + # parse arguments + parser = _get_parser() + args = _parse_arg(parser) + + # parse configuration file + oneutils.parse_cfg(args.config, 'one-resize', args) + + # verify arguments + _verify_arg(parser, args) + + # resize the model + _resize(args) + + +if __name__ == '__main__': + oneutils.safemain(main, __file__) diff --git a/compiler/one-cmds/onecc.template.cfg b/compiler/one-cmds/onecc.template.cfg index 8bc1e2a4ccb..a54110df2ac 100644 --- a/compiler/one-cmds/onecc.template.cfg +++ b/compiler/one-cmds/onecc.template.cfg @@ -14,6 +14,7 @@ one-import-tf=False one-import-tflite=False one-import-bcq=False one-import-onnx=False +one-resize=False ; circle to circle with optimization one-optimize=False ; circle to circle with quantization @@ -90,6 +91,15 @@ unroll_rnn= ; True or False unroll_lstm= +[one-resize] +# mandatory +; path to the input model +input_path= +; path to the resized model +output_path= +; the new shapes of inputs +input_shapes= + [one-optimize] # mandatory ; circle file diff --git a/compiler/one-cmds/onelib/CfgRunner.py b/compiler/one-cmds/onelib/CfgRunner.py index 13272525445..27a5f3240e5 100644 --- a/compiler/one-cmds/onelib/CfgRunner.py +++ b/compiler/one-cmds/onelib/CfgRunner.py @@ -27,8 +27,8 @@ def _simple_warning(message, category, filename, lineno, file=None, line=None): class CfgRunner: driver_sequence = [ - 'one-optimize', 'one-quantize', 'one-pack', 'one-codegen', 'one-profile', - 'one-partition', 'one-infer' + 'one-optimize', 'one-resize', 'one-quantize', 'one-pack', 'one-codegen', + 'one-profile', 'one-partition', 'one-infer' ] def __init__(self, path): diff --git a/compiler/one-cmds/onelib/OptionBuilder.py b/compiler/one-cmds/onelib/OptionBuilder.py index 6a75783ada4..750b196467b 100644 --- a/compiler/one-cmds/onelib/OptionBuilder.py +++ b/compiler/one-cmds/onelib/OptionBuilder.py @@ -80,9 +80,10 @@ def _build_quantize(self, commands): return options def build(self, commands): - cmd_book = dict.fromkeys( - ['one-import-bcq', 'one-import-tflite', 'one-pack', 'one-partition'], - self._build_default) + cmd_book = dict.fromkeys([ + 'one-import-bcq', 'one-import-tflite', 'one-resize', 'one-pack', + 'one-partition' + ], self._build_default) cmd_book['one-codegen'] = self._build_with_unknown_command cmd_book['one-import-onnx'] = self._build_import cmd_book['one-import-pytorch'] = self._build_import diff --git a/compiler/one-cmds/tests/one-build_001.test b/compiler/one-cmds/tests/one-build_001.test new file mode 100644 index 00000000000..317e90a4a39 --- /dev/null +++ b/compiler/one-cmds/tests/one-build_001.test @@ -0,0 +1,43 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# positive usage with overriding option + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" + +trap_err_onexit() +{ + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +config_file="one-resize_001.cfg" +output_file_cfg="inception_v3.resized.circle" + +rm -f ${filename}.log +rm -f ${output_file_cfg} + +# run test +one-build -C ${config_file} > ${filename}.log 2>&1 + +if [[ ! -s "${output_file_cfg}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/one-import_002.cfg b/compiler/one-cmds/tests/one-import_002.cfg index e7ede7bc2f4..079886cb565 100644 --- a/compiler/one-cmds/tests/one-import_002.cfg +++ b/compiler/one-cmds/tests/one-import_002.cfg @@ -2,6 +2,7 @@ one-import-tf=True one-import-tflite=False one-import-bcq=False +one-resize=True one-optimize=False one-quantize=False one-pack=False diff --git a/compiler/one-cmds/tests/one-import_003.cfg b/compiler/one-cmds/tests/one-import_003.cfg index b679ebdb3b6..e993d734cb9 100644 --- a/compiler/one-cmds/tests/one-import_003.cfg +++ b/compiler/one-cmds/tests/one-import_003.cfg @@ -2,6 +2,7 @@ one-import-tf=True one-import-tflite=False one-import-bcq=False +one-resize=False one-optimize=False one-quantize=False one-pack=False diff --git a/compiler/one-cmds/tests/one-import_004.cfg b/compiler/one-cmds/tests/one-import_004.cfg index d28c8dff642..2c9eae5a65a 100644 --- a/compiler/one-cmds/tests/one-import_004.cfg +++ b/compiler/one-cmds/tests/one-import_004.cfg @@ -2,6 +2,7 @@ one-import-tf=True one-import-tflite=False one-import-bcq=False +one-resize=False one-optimize=False one-quantize=False one-pack=False diff --git a/compiler/one-cmds/tests/one-import_005.cfg b/compiler/one-cmds/tests/one-import_005.cfg index abe4c7d7745..775a6980b2c 100644 --- a/compiler/one-cmds/tests/one-import_005.cfg +++ b/compiler/one-cmds/tests/one-import_005.cfg @@ -3,6 +3,7 @@ one-import-tf=False one-import-tflite=False one-import-bcq=False one-import-onnx=True +one-resize=False one-optimize=False one-quantize=False one-pack=False diff --git a/compiler/one-cmds/tests/one-resize_001.cfg b/compiler/one-cmds/tests/one-resize_001.cfg new file mode 100644 index 00000000000..6964ad0eeb5 --- /dev/null +++ b/compiler/one-cmds/tests/one-resize_001.cfg @@ -0,0 +1,14 @@ +[one-build] +one-import-tf=False +one-import-tflite=False +one-import-bcq=False +one-resize=True +one-optimize=False +one-quantize=False +one-pack=False +one-codegen=False + +[one-resize] +input_path=inception_v3.circle +output_path=inception_v3.resized.circle +input_shapes=[2,299,299,3] diff --git a/compiler/one-cmds/tests/one-resize_001.test b/compiler/one-cmds/tests/one-resize_001.test new file mode 100644 index 00000000000..68abb015579 --- /dev/null +++ b/compiler/one-cmds/tests/one-resize_001.test @@ -0,0 +1,46 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" +test_model_name="Add_000" + +trap_err_onexit() +{ + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +input_path="${test_model_name}.circle" +input_shapes="[1,3,3,1],[1,3,3,1]" +output_path="${test_model_name}.resize.circle" + +rm -f ${filename}.log +rm -f ${output_path} + +# run test +one-resize \ +--input_path ${input_path} \ +--input_shapes ${input_shapes} \ +--output_path ${output_path} > ${filename}.log 2>&1 + +if [[ ! -s "${output_path}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/one-resize_002.test b/compiler/one-cmds/tests/one-resize_002.test new file mode 100644 index 00000000000..1f8b69e5695 --- /dev/null +++ b/compiler/one-cmds/tests/one-resize_002.test @@ -0,0 +1,43 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# positive usage with overriding option + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" + +trap_err_onexit() +{ + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +config_file="one-resize_001.cfg" +output_file_cfg="inception_v3.resized.circle" + +rm -f ${filename}.log +rm -f ${output_file_cfg} + +# run test +one-resize -C ${config_file} > ${filename}.log 2>&1 + +if [[ ! -s "${output_file_cfg}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/one-resize_003.test b/compiler/one-cmds/tests/one-resize_003.test new file mode 100644 index 00000000000..3b246413a30 --- /dev/null +++ b/compiler/one-cmds/tests/one-resize_003.test @@ -0,0 +1,46 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" +test_model_name="Net_InstanceNorm_003" + +trap_err_onexit() +{ + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +input_path="${test_model_name}.circle" +input_shapes="[2,8,6,12]" +output_path="${test_model_name}.resize.circle" + +rm -f ${filename}.log +rm -f ${output_path} + +# run test +one-resize \ +-i ${input_path} \ +-s ${input_shapes} \ +-o ${output_path} > ${filename}.log 2>&1 + +if [[ ! -s "${output_path}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/one-resize_004.test b/compiler/one-cmds/tests/one-resize_004.test new file mode 100644 index 00000000000..16dd6274ca1 --- /dev/null +++ b/compiler/one-cmds/tests/one-resize_004.test @@ -0,0 +1,46 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" +test_model_name="dyn_llama2_query" + +trap_err_onexit() +{ + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +input_path="${test_model_name}.circle" +input_shapes="[2,16]" +output_path="${test_model_name}.resize.circle" + +rm -f ${filename}.log +rm -f ${output_path} + +# run test +one-resize \ +-i ${input_path} \ +-s ${input_shapes} \ +-o ${output_path} > ${filename}.log 2>&1 + +if [[ ! -s "${output_path}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/one-resize_005.test b/compiler/one-cmds/tests/one-resize_005.test new file mode 100644 index 00000000000..b5fc9c5c95d --- /dev/null +++ b/compiler/one-cmds/tests/one-resize_005.test @@ -0,0 +1,46 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" +test_model_name="dyn_llama2_norm" + +trap_err_onexit() +{ + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +input_path="${test_model_name}.circle" +input_shapes="[2,16]" +output_path="${test_model_name}.resize.circle" + +rm -f ${filename}.log +rm -f ${output_path} + +# run test +one-resize \ +-i ${input_path} \ +-s ${input_shapes} \ +-o ${output_path} > ${filename}.log 2>&1 + +if [[ ! -s "${output_path}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/one-resize_neg_001.test b/compiler/one-cmds/tests/one-resize_neg_001.test new file mode 100644 index 00000000000..46ca91f10a5 --- /dev/null +++ b/compiler/one-cmds/tests/one-resize_neg_001.test @@ -0,0 +1,49 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" +test_model_name="Add_000" + +trap_err_onexit() +{ + if grep -q "The following arguments are required: input_shapes" "${filename}.log"; then + echo "${filename_ext} SUCCESS" + exit 0 + fi + + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +input_path="${test_model_name}.circle" +output_path="${test_model_name}.resize.circle" + +rm -f ${filename}.log +rm -f ${output_path} + +# run test +one-resize \ +--input_path ${input_path} \ +--output_path ${output_path} > ${filename}.log 2>&1 + +if [[ ! -s "${output_path}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/one-resize_neg_002.test b/compiler/one-cmds/tests/one-resize_neg_002.test new file mode 100644 index 00000000000..33ee28a5f62 --- /dev/null +++ b/compiler/one-cmds/tests/one-resize_neg_002.test @@ -0,0 +1,51 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" +test_model_name="Add_000" + +trap_err_onexit() +{ + if grep -q "No shapes found in the input string: abcd" "${filename}.log"; then + echo "${filename_ext} SUCCESS" + exit 0 + fi + + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +input_path="${test_model_name}.circle" +input_shapes="abcd" +output_path="${test_model_name}.resize.circle" + +rm -f ${filename}.log +rm -f ${output_path} + +# run test +one-resize \ +--input_path ${input_path} \ +--input_shapes ${input_shapes} \ +--output_path ${output_path} > ${filename}.log 2>&1 + +if [[ ! -s "${output_path}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/onecc_070.cfg b/compiler/one-cmds/tests/onecc_070.cfg new file mode 100644 index 00000000000..481e8459f49 --- /dev/null +++ b/compiler/one-cmds/tests/onecc_070.cfg @@ -0,0 +1,15 @@ +[onecc] +one-import-tf=False +one-import-tflite=False +one-import-bcq=False +one-import-onnx=False +one-resize=True +one-optimize=False +one-quantize=False +one-pack=False +one-codegen=False + +[one-resize] +input_path=inception_v3.circle +output_path=inception_v3.resized.circle +input_shapes=[2,299,299,3] diff --git a/compiler/one-cmds/tests/onecc_070.test b/compiler/one-cmds/tests/onecc_070.test new file mode 100644 index 00000000000..ef30ff07a75 --- /dev/null +++ b/compiler/one-cmds/tests/onecc_070.test @@ -0,0 +1,43 @@ +#!/bin/bash + +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# one-import-tf -> one-quantize + +filename_ext="$(basename -- $0)" +filename="${filename_ext%.*}" + +trap_err_onexit() +{ + echo "${filename_ext} FAILED" + exit 255 +} + +trap trap_err_onexit ERR + +config_file="onecc_070.cfg" +output_file="inception_v3.resized.circle" + +rm -f ${filename}.log +rm -rf ${output_file} + +# run test +onecc -C ${config_file} > ${filename}.log 2>&1 + +if [[ ! -s "${output_file}" ]]; then + trap_err_onexit +fi + +echo "${filename_ext} SUCCESS" diff --git a/compiler/one-cmds/tests/prepare_test_materials.sh b/compiler/one-cmds/tests/prepare_test_materials.sh index 065c2dcc5dd..067eb744c61 100644 --- a/compiler/one-cmds/tests/prepare_test_materials.sh +++ b/compiler/one-cmds/tests/prepare_test_materials.sh @@ -135,6 +135,21 @@ if [[ ! -s "onnx_conv2d_conv2d_split.onnx" ]]; then # https://github.com/Samsung/ONE/issues/11280#issuecomment-1732852295 fi +# prepare models to test circle-resizer +if [[ ! -s "dyn_llama2_query.circle" ]]; then + rm -rf dyn_llama2_query.zip + wget -nv https://github.com/user-attachments/files/19584809/dyn_llama2_query.zip + unzip dyn_llama2_query.zip + # https://github.com/Samsung/ONE/issues/14791#issue-2902255581 +fi + +if [[ ! -s "dyn_llama2_norm.circle" ]]; then + rm -rf dyn_llama2_norm.zip + wget -nv https://github.com/user-attachments/files/19584810/dyn_llama2_norm.zip + unzip dyn_llama2_norm.zip + # https://github.com/Samsung/ONE/issues/14791#issue-2902255581 +fi + if [[ ! -s "Add_000.inputs.txt" ]]; then rm -rf Add_000.inputs.txt echo "Add_000.circle.input0 Add_000.circle.input1" >> Add_000.inputs.txt