summaryrefslogtreecommitdiff
path: root/tests/nnapi/specs/V1_1/sub_broadcast_4D_2D_float_nnfw.mod.py
blob: ede48f0839d526b7fce03852fc83c745aee57bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{3, 2, 2, 2}")
i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2}")
act = Int32Scalar("act", 0) # an int32_t scalar fuse_activation
i3 = Output("op3", "TENSOR_FLOAT32", "{3, 2, 2, 2}")
model = model.Operation("SUB", i1, i2, act).To(i3)

# Example 1. Input in operand 0,
input0 = {i1: # input 0
          [0.02648412, 0.12737854, 0.92319058, 0.60023185, 0.35821535, 0.96402954, 0.64612486, 0.71984435,
           0.59125833, 0.18123407, 0.47523563, 0.35624883, 0.67594663, 0.69254679, 0.63816926, 0.82754998,
           0.4535841,  0.66132381, 0.40122975, 0.02461688, 0.58031493, 0.44518958, 0.26908303, 0.82039221],
          i2: # input 1
          [0.52241209, 0.02719438, 0.071708, 0.6779468]
         }
output0 = {i3: # output 0
          [-0.49592797, 0.10018416, 0.85148259, -0.07771495, -0.16419674, 0.93683516, 0.57441687, 0.04189755,
            0.06884624, 0.15403969, 0.40352763, -0.32169797, 0.15353454, 0.66535241, 0.56646126, 0.14960318,
           -0.06882799, 0.63412943, 0.32952176, -0.65332992, 0.05790284,  0.4179952, 0.19737503,  0.14244541]
          }

# Instantiate an example
Example((input0, output0))