From da5cdadcd914e7c53a007429b783d793d355fbab Mon Sep 17 00:00:00 2001 From: Aaron Wang Shi Date: Thu, 11 May 2023 11:18:52 +0800 Subject: [PATCH] Remove deprecated tests --- build-tools/make/build-with-docker.mk | 11 -- build-tools/make/build.mk | 25 ---- .../test/callback/function_test_callback.py | 34 ----- .../test/scripts/check_function_result.py | 51 -------- ...nnabla_c_runtime_function_test_makefile.py | 119 ------------------ .../test/scripts/diff_function_test_result.py | 33 ----- build-tools/test/scripts/diff_result.py | 26 ---- .../test/scripts/exec_all_functions.sh | 44 ------- build-tools/test/scripts/generate_yaml.py | 53 -------- doc/BUILD.md | 7 -- 10 files changed, 403 deletions(-) delete mode 100644 build-tools/test/callback/function_test_callback.py delete mode 100644 build-tools/test/scripts/check_function_result.py delete mode 100644 build-tools/test/scripts/create_nnabla_c_runtime_function_test_makefile.py delete mode 100644 build-tools/test/scripts/diff_function_test_result.py delete mode 100644 build-tools/test/scripts/diff_result.py delete mode 100755 build-tools/test/scripts/exec_all_functions.sh delete mode 100644 build-tools/test/scripts/generate_yaml.py diff --git a/build-tools/make/build-with-docker.mk b/build-tools/make/build-with-docker.mk index 0347758..ad3ba16 100644 --- a/build-tools/make/build-with-docker.mk +++ b/build-tools/make/build-with-docker.mk @@ -192,17 +192,6 @@ bwd-check-api_level: nnabla-c-runtime-docker_image_test ######################################################################################################################## # Tests -.PHONY: bwd-nnabla-c-runtime-generate-function-test -bwd-nnabla-c-runtime-generate-function-test: nnabla-c-runtime-docker_image_test - cd $(NNABLA_C_RUNTIME_DIRECTORY) \ - && docker run $(NNABLA_C_RUNTIME_DOCKER_RUN_OPTS) \ - $(NNABLA_C_RUNTIME_DOCKER_IMAGE_TEST) make nnabla-c-runtime-generate-function-test - -.PHONY: bwd-nnabla-c-runtime-test-all-functions -bwd-nnabla-c-runtime-test-all-functions: nnabla-c-runtime-docker_image_test - cd $(NNABLA_C_RUNTIME_DIRECTORY) \ - && docker run $(NNABLA_C_RUNTIME_DOCKER_RUN_OPTS) \ - $(NNABLA_C_RUNTIME_DOCKER_IMAGE_TEST) make nnabla-c-runtime-test-all-functions ifneq ("$(NNABLA_EXAMPLES_DIRECTORY)","") diff --git a/build-tools/make/build.mk b/build-tools/make/build.mk index 1cfedec..ff06c92 100644 --- a/build-tools/make/build.mk +++ b/build-tools/make/build.mk @@ -89,31 +89,6 @@ nnabla-c-runtime-update-function-info: nnabla-install check-api_level: nnabla-c-runtime-build nnabla-install @bash ./build-tools/test/scripts/check_api_level.sh $(NNABLA_C_RUNTIME_DIRECTORY) -.PHONY: nnabla-c-runtime-generate-function-test -nnabla-c-runtime-generate-function-test: nnabla-install - @mkdir -p $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla - @cd $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla && PYTHONPATH=$$(cd ../../../build-tools/test/callback && pwd) \ - python -m pytest ${PYTEST_OPTS} ../../../../nnabla/python/test - @NNABLA_C_RUNTIME_TEST_DIRECTORY=$(NNABLA_C_RUNTIME_TEST_DIRECTORY) $(NNABLA_C_RUNTIME_DIRECTORY)/build-tools/test/scripts/exec_all_functions.sh - @python build-tools/test/scripts/generate_yaml.py - @rm -rf $(NNABLA_C_RUNTIME_REFERENCE_DIRECTORY)/functions - @mkdir -p $(NNABLA_C_RUNTIME_REFERENCE_DIRECTORY)/functions - @ln $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla/succeed/*.nntxt $(NNABLA_C_RUNTIME_REFERENCE_DIRECTORY)/functions/ - @ln $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla/succeed/*.yaml $(NNABLA_C_RUNTIME_REFERENCE_DIRECTORY)/functions/ - @ln $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla/succeed/*_input_*.bin $(NNABLA_C_RUNTIME_REFERENCE_DIRECTORY)/functions/ - @ln $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla/succeed/*_output_?.bin $(NNABLA_C_RUNTIME_REFERENCE_DIRECTORY)/functions/ - @rm -f $(NNABLA_C_RUNTIME_REFERENCE_DIRECTORY)/functions/*_nnabla_cli_output_?.bin - -.PHONY: nnabla-c-runtime-test-all-functions -nnabla-c-runtime-test-all-functions: nnabla-c-runtime-build nnabla-install - @rm -rf $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla-c-runtime/nnb - @rm -rf $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla-c-runtime/csrc - @mkdir -p $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla-c-runtime/ - @python build-tools/test/scripts/create_nnabla_c_runtime_function_test_makefile.py - @NNABLA_C_RUNTIME_REFERENCE_DIRECTORY=$(NNABLA_C_RUNTIME_REFERENCE_DIRECTORY) \ - NNABLA_C_RUNTIME_TEST_DIRECTORY=$(NNABLA_C_RUNTIME_TEST_DIRECTORY) \ - $(MAKE) -k -j1 -f $(NNABLA_C_RUNTIME_TEST_DIRECTORY)/nnabla-c-runtime/test_functions.mk - ifneq ("$(NNABLA_EXAMPLES_DIRECTORY)","") .PHONY: nnabla-c-runtime-generate-mnist-test diff --git a/build-tools/test/callback/function_test_callback.py b/build-tools/test/callback/function_test_callback.py deleted file mode 100644 index 654ed43..0000000 --- a/build-tools/test/callback/function_test_callback.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2018,2019,2020,2021 Sony Corporation. -# Copyright 2021 Sony Group Corporation. -# -# 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 google.protobuf.text_format as text_format - -result_nums = {} - - -def callback(name, nnp, inputs, outputs): - if name not in result_nums: - result_nums[name] = 0 - - save_filename = '{}_{:03d}.nntxt'.format(name, result_nums[name]) - - for n, i in enumerate(inputs): - i.tofile('{}_{:03d}_input_{}.bin'.format( - name, result_nums[name], n)) - for n, o in enumerate(outputs): - o.tofile('{}_{:03d}_output_{}.bin'.format( - name, result_nums[name], n)) - with open(save_filename, 'w') as f: - text_format.PrintMessage(nnp, f) - result_nums[name] += 1 diff --git a/build-tools/test/scripts/check_function_result.py b/build-tools/test/scripts/check_function_result.py deleted file mode 100644 index 7d2a35c..0000000 --- a/build-tools/test/scripts/check_function_result.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2018,2019,2020,2021 Sony Corporation. -# Copyright 2021 Sony Group Corporation. -# -# 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 glob -import os -import re -import sys - - -def check_error(lines): - diff_errors = 0 - memory_errors = 0 - for n, l in enumerate(lines): - l = l.rstrip() - match = re.search('ERROR SUMMARY: ([0-9]+) errors', l) - if match: - memory_errors += int(match.group(1)) - if l == 'False': - diff_errors += 1 - return memory_errors, diff_errors - - -print('Testname, Memleak(CSRC), Diff(CSRC), Memleak(NNB), Diff(NNB)') -for csrclog in sorted(glob.glob('{}/nnablart/csrc/*.log'.format(os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY']))): - nnblog = '{}/nnb/{}'.format( - os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], os.path.basename(csrclog)) - with open(csrclog, 'r') as f: - csrc_memory_errors, csrc_diff_errors = check_error(f.readlines()) - with open(nnblog, 'r') as f: - nnb_memory_errors, nnb_diff_errors = check_error(f.readlines()) - filename = os.path.basename(csrclog) - name, ext = os.path.splitext(filename) - print('{}, {}, {}, {}, {}'.format(name, csrc_memory_errors, - csrc_diff_errors, nnb_memory_errors, nnb_diff_errors)) - if csrc_memory_errors != 0 or csrc_diff_errors != 0: - sys.stderr.write( - '\tCSRC has some error plese see {}\n'.format(csrclog)) - if nnb_memory_errors != 0 or nnb_diff_errors != 0: - sys.stderr.write('\tNNB has some error plese see {}\n'.format(csrclog)) diff --git a/build-tools/test/scripts/create_nnabla_c_runtime_function_test_makefile.py b/build-tools/test/scripts/create_nnabla_c_runtime_function_test_makefile.py deleted file mode 100644 index 97b3fd3..0000000 --- a/build-tools/test/scripts/create_nnabla_c_runtime_function_test_makefile.py +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright 2018,2019,2020,2021 Sony Corporation. -# Copyright 2021 Sony Group Corporation. -# -# 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 glob -import os - -functions = {} -for f in glob.glob('{}/functions/*.nntxt'.format(os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'])): - print(f) - name, ext = os.path.splitext(os.path.basename(f)) - functions[name] = f - -with open('{}/nnabla-c-runtime/test_functions.mk'.format(os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY']), 'w') as f: - f.write('all: \\\n') - - func_list = [] - if 'CRUNTIME_TEST_FUNCTION_LIST' in os.environ: - func_list = ' '.join( - os.environ['CRUNTIME_TEST_FUNCTION_LIST'].split(',')).split() - func_exclude_list = [] - if 'CRUNTIME_TEST_FUNCTION_EXCLUDE_LIST' in os.environ: - func_exclude_list = ' '.join( - os.environ['CRUNTIME_TEST_FUNCTION_EXCLUDE_LIST'].split(',')).split() - print('FUNCTION_LIST: {}, FUNCTION_EXCLUDE_LIST: {}'.format( - func_list, func_exclude_list)) - - target_list = [] - for function in sorted(functions): - name = function.rsplit('_', 1)[0] - if len(func_list) > 0: - if name in func_list: - if name not in func_exclude_list: - target_list.append(' test_{}'.format(function)) - else: - if name not in func_exclude_list: - target_list.append(' test_{}'.format(function)) - f.write('\t') - f.write(' \\\n\t'.join(target_list)) - f.write('\n') - f.write('\t@echo All test finished.\n') - f.write('\t@echo Result CSV start\n') - f.write('\t@python build-tools/test/scripts/check_function_result.py |tee {}/nnabla-c-runtime/result.csv\n'.format( - os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'])) - f.write('\t@echo Result CSV end\n') - - f.write('\n') - - for function in sorted(functions): - nntxt = functions[function] - csrclog = '{}/nnabla-c-runtime/csrc/{}.log'.format( - os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], function) - nnblog = '{}/nnabla-c-runtime/nnb/{}.log'.format( - os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], function) - f.write('test_{}:\n'.format(function)) - f.write('\t@echo Testing {}\n'.format(function)) - f.write('\t@mkdir -p {}/nnabla-c-runtime/csrc/{}\n'.format( - os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], function)) - f.write('\t@nnabla_cli convert -O CSRC {} {}/nnabla-c-runtime/csrc/{} >>{} 2>&1\n'.format( - nntxt, os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], function, csrclog)) - f.write( - '\t@$(MAKE) -C {}/nnabla-c-runtime/csrc/{}\\\n'.format(os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], function)) - f.write('\t\tCFLAGS="-I ../../../../../include"\\\n') - f.write( - '\t\tLDFLAGS="-L../../../../../build/src/functions" >>{} 2>&1\n'.format(csrclog)) - f.write('\t@valgrind --leak-check=full {}/nnabla-c-runtime/csrc/{}/network1_example\\\n'.format( - os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], function)) - f.write( - '\t\t{}/functions/{}_input_*.bin\\\n'.format(os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], function)) - f.write( - '\t\t{}/nnabla-c-runtime/csrc/{}/network1_example_output >>{} 2>&1\n'.format(os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], function, csrclog)) - f.write('\t@mkdir -p {}/nnabla-c-runtime/nnb\n'.format( - os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'])) - for output in sorted(glob.glob('{}/functions/{}_output_?.bin'.format(os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], function))): - name, ext = os.path.splitext(output) - num = name.rsplit('_', 1)[1] - f.write( - '\t@python build-tools/test/scripts/diff_result.py\\\n'.format(output)) - f.write('\t\t{}\\\n'.format(output)) - f.write( - '\t\t{}/nnabla-c-runtime/csrc/{}/network1_example_output_{}.bin >>{} 2>&1\n'.format(os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], function, num, csrclog)) - for o in sorted(glob.glob('{}/functions/{}_*.yaml'.format(os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], function))): - name, ext = os.path.splitext(os.path.basename(o)) - f.write('\t@nnabla_cli convert {} {}/nnabla-c-runtime/nnb/{}.nnb -s {} >>{} 2>&1\n'.format( - nntxt, os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], name, o, nnblog)) - f.write( - '\t@valgrind --leak-check=full ./build/src/nnablart/nnablart dump\\\n') - f.write( - '\t\t{}/nnabla-c-runtime/nnb/{}.nnb >>{} 2>&1\n'.format(os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], name, nnblog)) - f.write( - '\t@valgrind --leak-check=full ./build/src/nnablart/nnablart infer\\\n') - f.write('\t\t{}/nnabla-c-runtime/nnb/{}.nnb\\\n'.format( - os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], name)) - f.write( - '\t\t{}/functions/{}_input_*.bin\\\n'.format(os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], function)) - f.write( - '\t\t{}/nnabla-c-runtime/nnb/{}_output >>{} 2>&1\n'.format(os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], name, nnblog)) - for output in sorted(glob.glob('{}/functions/{}_output_?.bin'.format(os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], function))): - n, ext = os.path.splitext(output) - num = n.rsplit('_', 1)[1] - f.write( - '\t@python build-tools/test/scripts/diff_result.py\\\n'.format(output)) - f.write('\t\t{}\\\n'.format(output)) - f.write( - '\t\t{}/nnabla-c-runtime/nnb/{}_output_{}.bin >>{} 2>&1\n'.format(os.environ['NNABLA_C_RUNTIME_TEST_DIRECTORY'], name, num, nnblog)) - f.write('') - f.write('') - f.write('\n') diff --git a/build-tools/test/scripts/diff_function_test_result.py b/build-tools/test/scripts/diff_function_test_result.py deleted file mode 100644 index 3f33889..0000000 --- a/build-tools/test/scripts/diff_function_test_result.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2018,2019,2020,2021 Sony Corporation. -# Copyright 2021 Sony Group Corporation. -# -# 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 glob -import numpy -import sys - -result = True -for out1, out2 in zip(sorted(glob.glob('{}[0-9]*.bin'.format(sys.argv[1]))), - sorted(glob.glob('{}[0-9]*.bin'.format(sys.argv[2])))): - data1 = numpy.fromfile(out1, numpy.float32) - data2 = numpy.fromfile(out2, numpy.float32) - res = numpy.allclose(data1, data2, atol=1e-4) - print(out1, out2, res) - if not res: - print("WARNING: differ with 1e-4, check it again with 1e-2...") - res = numpy.allclose(data1, data2, atol=1e-2) - if not res: - result = False -if not result: - sys.exit(255) diff --git a/build-tools/test/scripts/diff_result.py b/build-tools/test/scripts/diff_result.py deleted file mode 100644 index f018a2d..0000000 --- a/build-tools/test/scripts/diff_result.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2018,2019,2020,2021 Sony Corporation. -# Copyright 2021 Sony Group Corporation. -# -# 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 numpy -import sys - -data1 = numpy.fromfile(sys.argv[1], numpy.float32) -data2 = numpy.fromfile(sys.argv[2], numpy.float32) -res = numpy.allclose(data1, data2, atol=1e-4) -print(data1) -print(data2) -print(res) - -sys.exit(0) diff --git a/build-tools/test/scripts/exec_all_functions.sh b/build-tools/test/scripts/exec_all_functions.sh deleted file mode 100755 index f6be661..0000000 --- a/build-tools/test/scripts/exec_all_functions.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Copyright 2018,2019,2020,2021 Sony Corporation. -# Copyright 2021 Sony Group Corporation. -# -# 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. - -set -eu -mkdir -p ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/succeed -mkdir -p ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/output_differ -mkdir -p ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/cannot_test - -for f in $(find ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla -maxdepth 1 -name '*_???.nntxt' |sort) -do - base=$(basename $f .nntxt) - echo -n $base" " - inputs=$(find ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla -maxdepth 1 -name ${base}_input_\*.bin |sort) - output_prefix=${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/${base}_nnabla_cli_output - if nnabla_cli infer -b 1 -c $f -o $output_prefix $inputs &> ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/${base}.log - then - result=0 - if python3 build-tools/test/scripts/diff_function_test_result.py ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/${base}_output_ ${output_prefix}_ # &>/dev/null - then - echo " Succeed" - mv ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/${base}* ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/succeed - else - echo " Output Differ" - mv ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/${base}* ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/output_differ - fi - - else - echo Cannot test - mv ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/${base}* ${NNABLA_C_RUNTIME_TEST_DIRECTORY}/nnabla/cannot_test - fi -done diff --git a/build-tools/test/scripts/generate_yaml.py b/build-tools/test/scripts/generate_yaml.py deleted file mode 100644 index 7c48943..0000000 --- a/build-tools/test/scripts/generate_yaml.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2018,2019,2020,2021 Sony Corporation. -# Copyright 2021 Sony Group Corporation. -# -# 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 google.protobuf.text_format as text_format -import nnabla.utils.nnabla_pb2 as nnabla_pb2 -import glob -import os - -for f in sorted(glob.glob('{}/succeed/*.nntxt'.format(os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY']))): - name, ext = os.path.splitext(os.path.basename(f)) - os.system('nnabla_cli nnb_template {} {}/succeed/{}_float32.yaml'.format( - f, os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], name)) - parameter_name = [] - proto = nnabla_pb2.NNablaProtoBuf() - with open(f, 'r') as o: - text_format.Merge(o.read(), proto) - for executor in proto.executor: - for parameter_variable in executor.parameter_variable: - if parameter_variable is not None: - parameter_name.append(parameter_variable.variable_name) - if parameter_name: - fixed16_data = '' - fixed8_data = '' - with open('{}/succeed/{}_float32.yaml'.format( - os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], name), 'r') as f: - for line in f: - count = 0 - for name_ in parameter_name: - if name_ in line: - fixed16_data += line.replace('FLOAT32', 'FIXED16') - fixed8_data += line.replace('FLOAT32', 'FIXED8') - count += 1 - break - if count == 0: - fixed16_data += line - fixed8_data += line - with open('{}/succeed/{}_fixed16.yaml'.format( - os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], name), 'w') as f: - f.write(fixed16_data) - with open('{}/succeed/{}_fixed8.yaml'.format( - os.environ['NNABLA_C_RUNTIME_REFERENCE_DIRECTORY'], name), 'w') as f: - f.write(fixed8_data) diff --git a/doc/BUILD.md b/doc/BUILD.md index 876b232..f38871d 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -77,13 +77,6 @@ $ make - nnabla-c-runtime-update-function-info - bwd-nnabla-c-runtime-update-function-info -#### Tests (Needs `nnabla` directory) -- nnabla-c-runtime-generate-function-test -- bwd-nnabla-c-runtime-generate-function-test - -- nnabla-c-runtime-test-all-functions -- bwd-nnabla-c-runtime-test-all-functions - #### Development in docker container (Needs `nnabla` directory) - bwd-nnabla-c-runtime-shell