Imported Upstream version 1.7.0
[platform/core/ml/nnfw.git] / tests / nnapi / specs / V1_2 / topk_v2_2D_float_nnfw.mod.py
1 # model
2 model = Model()
3 i1 = Input("op1", "TENSOR_FLOAT32", "{3,4}") # a matirx of input
4 k = Int32Scalar("k", 2)
5 o1 = Output("op2", "TENSOR_FLOAT32", "{3,2}") # values of output
6 o2 = Output("op3", "TENSOR_INT32", "{3,2}") # indexes of output
7 model = model.Operation("TOPK_V2", i1, k).To([o1, o2])
8
9 # Example 1. Input in operand 0,
10 input0 = {i1: # input 0
11           [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789,
12           7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789,
13           2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789]}
14
15 output0 = {o1: # output 1
16            [6.123456789123456789, 5.123456789123456789,
17            9.123456789123456789, 8.123456789123456789,
18            19.123456789123456789, 18.123456789123456789],
19            o2: # output 1
20            [3, 2,
21            2, 1,
22            2, 1]}
23
24 # Instantiate an example
25 Example((input0, output0))