Imported Upstream version 1.7.0
[platform/core/ml/nnfw.git] / tests / nnapi / specs / Ex / reverse_ex_dynamic_3D.mod.py
1 #
2 # Copyright (C) 2018 The Android Open Source Project
3 # Copyright (c) 2020 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
18
19 import dynamic_tensor
20
21 model = Model()
22
23 model_input_shape = [4, 3, 2]
24
25 axis = Input("input1", "TENSOR_INT32", "{1}")
26
27 output0 = Output("output0", "TENSOR_FLOAT32", "{4, 3, 2}")
28
29
30 dynamic_layer = dynamic_tensor.DynamicInputGenerator(model, model_input_shape, "TENSOR_FLOAT32")
31
32 test_node_input = dynamic_layer.getTestNodeInput()
33
34 model.Operation("REVERSE_EX", test_node_input, axis).To([output0])
35
36 model_input_data = [1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12,
37                  13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
38
39 output_0_data = [5,  6,  3,  4,  1,  2,  11, 12, 9,  10, 7,  8,
40                  17, 18, 15, 16, 13, 14, 23, 24, 21, 22, 19, 20]
41
42 Example(
43   {
44     dynamic_layer.getModelInput() : model_input_data,
45     dynamic_layer.getShapeInput() : model_input_shape,
46
47     axis: [1],
48
49     output0: output_0_data,
50   })