summaryrefslogtreecommitdiff
path: root/tests/nnapi/specs/V1_0/fully_connected_hybrid_1_nnfw.mod.py
blob: d9bcf1610aadc5b2561da68afd71a0e27b6c9ed6 (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
25
26
27
28
29
30
31
32
33
34
#
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

model = Model()
in0 = Input("op1", "TENSOR_FLOAT32", "{1, 3, 4, 2}")
weights = Parameter("op2", "TENSOR_QUANT8_SYMM", "{1, 24}, 0.0236220472, 0",
      [-11, 0, -90, 0, -48, 0, -44, 0, -95, 0, -4, 0, -56, 0, 6, 0, -22, 0, -20, 0, -61, 0, -68, 0])
bias = Parameter("b0", "TENSOR_FLOAT32", "{1}",
     [0.70098364,])
out0 = Output("op3", "TENSOR_FLOAT32", "{1, 1}")
act_relu = Int32Scalar("act_relu", 0)
model = model.Operation("FULLY_CONNECTED", in0, weights, bias, act_relu).To(out0)

# Example 1. Input in operand 0,
input0 = {in0: # input 0
          [1.4910057783, 3.4019672871, -0.0598693565, -0.0065411143, -0.6461477280, 1.9235717058, 1.0784962177, 0.1765922010, -2.2495496273, -1.6010370255, -2.4747757912, -0.3825767934, 2.3058984280, 0.7288306952, -0.8964791894, -2.7584488392, -0.2875919640, 0.1335377693, 1.8338065147, -2.6112849712, 0.9390821457, 1.9843852520, -1.2190681696, 1.0274435282, ]}
output0 = {out0: # output 0
           [2.070921897]}

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