Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / compiler / one-cmds / tests / onecc_045.test
1 #!/bin/bash
2
3 # Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #    http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 filename_ext="$(basename -- $0)"
18 filename="${filename_ext%.*}"
19
20 # TODO Resolve circledump not found
21 # https://github.com/Samsung/ONE/issues/10550
22 if ! command -v circledump &> /dev/null
23 then
24   echo "${filename_ext} SKIPPED"
25   exit 0
26 fi
27
28 trap_err_onexit()
29 {
30   echo "${filename_ext} FAILED"
31   exit 255
32 }
33
34 trap trap_err_onexit ERR
35
36 inputfile="./reshape_matmul.circle"
37 configfile="onecc_045.cfg"
38 outputfile="reshape_matmul.onecc_045.q.circle"
39
40 rm -f ${filename}.log
41 rm -f ${filename}.first.cdump
42 rm -f ${filename}.second.cdump
43 rm -f ${outputfile}
44
45 # run test
46 onecc -C ${configfile} > ${filename}.log 2>&1
47
48 if [[ ! -s "${outputfile}" ]]; then
49   trap_err_onexit
50 fi
51
52 circledump ${outputfile} | grep "T(0:0)" > ${filename}.first.cdump
53 circledump ${outputfile} | grep "T(0:1)" > ${filename}.second.cdump
54
55 # check dtype of the first input (uint8)
56 if ! grep -q "UINT8" "${filename}.first.cdump"; then
57   trap_err_onexit
58 fi
59
60 # check dtype of the second input (int16)
61 if ! grep -q "INT16" "${filename}.second.cdump"; then
62   trap_err_onexit
63 fi
64
65 echo "${filename_ext} SUCCESS"