Imported Upstream version 1.7.0
[platform/core/ml/nnfw.git] / tests / nnapi / specs / skip / V1_1 / svdf_state_relaxed.mod.py
1 #
2 # Copyright (C) 2018 The Android Open Source Project
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 batches = 2
18 units = 4
19 input_size = 3
20 memory_size = 10
21
22 model = Model()
23
24 input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (batches, input_size))
25 weights_feature = Input("weights_feature", "TENSOR_FLOAT32", "{%d, %d}" % (units, input_size))
26 weights_time = Input("weights_time", "TENSOR_FLOAT32", "{%d, %d}" % (units, memory_size))
27 bias = Input("bias", "TENSOR_FLOAT32", "{%d}" % (units))
28 state_in = Input("state_in", "TENSOR_FLOAT32", "{%d, %d}" % (batches, memory_size*units))
29 rank_param = Int32Scalar("rank_param", 1)
30 activation_param = Int32Scalar("activation_param", 0)
31 state_out = Output("state_out", "TENSOR_FLOAT32", "{%d, %d}" % (batches, memory_size*units))
32 output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (batches, units))
33
34 model = model.Operation("SVDF", input, weights_feature, weights_time, bias, state_in,
35                         rank_param, activation_param).To([state_out, output])
36 model = model.RelaxedExecution(True)
37
38 input0 = {
39     weights_feature: [
40         -0.31930989, -0.36118156, 0.0079667, 0.37613347,
41       0.22197971, 0.12416199, 0.27901134, 0.27557442,
42       0.3905206, -0.36137494, -0.06634006, -0.10640851
43     ],
44     weights_time: [
45         -0.31930989, 0.37613347,  0.27901134,  -0.36137494, -0.36118156,
46       0.22197971,  0.27557442,  -0.06634006, 0.0079667,   0.12416199,
47
48        0.3905206,   -0.10640851, -0.0976817,  0.15294972,  0.39635518,
49       -0.02702999, 0.39296314,  0.15785322,  0.21931258,  0.31053296,
50
51        -0.36916667, 0.38031587,  -0.21580373, 0.27072677,  0.23622236,
52       0.34936687,  0.18174365,  0.35907319,  -0.17493086, 0.324846,
53
54        -0.10781813, 0.27201805,  0.14324132,  -0.23681851, -0.27115166,
55       -0.01580888, -0.14943552, 0.15465137,  0.09784451,  -0.0337657
56     ],
57     bias: [],
58 }
59
60 input0[input] = [
61   0.14278367,  -1.64410412, -0.75222826,
62   0.14278367,  -1.64410412, -0.75222826,
63 ]
64 input0[state_in]  = [
65   0, 0, 0, 0,
66   0, 0, 0, 0,
67   0.119996, 0, 0, 0,
68   0, 0, 0, 0,
69   0, 0, -0.166701, 0,
70   0, 0, 0, 0,
71   0, 0, 0, 0,
72   -0.44244, 0, 0, 0,
73   0, 0, 0, 0,
74   0, 0, 0.0805206, 0,
75   0, 0, 0, 0,
76   0, 0, 0, 0,
77   0.119996, 0, 0, 0,
78   0, 0, 0, 0,
79   0, 0, -0.166701, 0,
80   0, 0, 0, 0,
81   0, 0, 0, 0,
82   -0.44244, 0, 0, 0,
83   0, 0, 0, 0,
84   0, 0, 0.0805206, 0,
85 ]
86 output0 = {
87     state_out : [
88   0, 0, 0, 0,
89   0, 0, 0, 0.119996,
90   0.542235, 0, 0, 0,
91   0, 0, 0, 0,
92   0, -0.166701, -0.40465, 0,
93   0, 0, 0, 0,
94   0, 0, 0, -0.44244,
95   -0.706995, 0, 0, 0,
96   0, 0, 0, 0,
97   0, 0.0805206, 0.137515, 0,
98   0, 0, 0, 0,
99   0, 0, 0, 0.119996,
100   0.542235, 0, 0, 0,
101   0, 0, 0, 0,
102   0, -0.166701, -0.40465, 0,
103   0, 0, 0, 0,
104   0, 0, 0, -0.44244,
105   -0.706995, 0, 0, 0,
106   0, 0, 0, 0,
107   0, 0.0805206, 0.137515, 0,
108     ],
109     output : [
110   0.068281,    -0.162217,  -0.152268, 0.00323521,
111   0.068281,    -0.162217,  -0.152268, 0.00323521,
112     ]
113 }
114
115 Example((input0, output0))