relu_float_1_relaxed.mod.py revision b74d2837ab1687c1a4f913aa5f90a9838efe0add
181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent#
281784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# Copyright (C) 2018 The Android Open Source Project
381784c37c61b09289654b979567a42bf73cd2b12Eric Laurent#
481784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# Licensed under the Apache License, Version 2.0 (the "License");
581784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# you may not use this file except in compliance with the License.
681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# You may obtain a copy of the License at
781784c37c61b09289654b979567a42bf73cd2b12Eric Laurent#
881784c37c61b09289654b979567a42bf73cd2b12Eric Laurent#      http://www.apache.org/licenses/LICENSE-2.0
981784c37c61b09289654b979567a42bf73cd2b12Eric Laurent#
1081784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# Unless required by applicable law or agreed to in writing, software
1181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# distributed under the License is distributed on an "AS IS" BASIS,
1281784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1381784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# See the License for the specific language governing permissions and
1481784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# limitations under the License.
1581784c37c61b09289654b979567a42bf73cd2b12Eric Laurent#
1681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent
1781784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# model
1881784c37c61b09289654b979567a42bf73cd2b12Eric Laurentmodel = Model()
1981784c37c61b09289654b979567a42bf73cd2b12Eric Laurenti1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # input 0
2081784c37c61b09289654b979567a42bf73cd2b12Eric Laurenti2 = Output("op2", "TENSOR_FLOAT32", "{1, 2, 2, 1}") # output 0
2181784c37c61b09289654b979567a42bf73cd2b12Eric Laurentmodel = model.Operation("RELU", i1).To(i2)
22153b9fe667e6e78e0218ff0159353097428c7657Glenn Kastenmodel = model.RelaxedExecution(True)
23ad8510a339ffab330c2c46e5c247dd1cf9e15c22Glenn Kasten
2481784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# Example 1. Input in operand 0,
25ee499291404a192b059f2e04c5afc65aa6cdd74cElliott Hughesinput0 = {i1: # input 0
2681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent          [-10.0, -0.5, 0.5, 10.0]}
2781784c37c61b09289654b979567a42bf73cd2b12Eric Laurentoutput0 = {i2: # output 0
2881784c37c61b09289654b979567a42bf73cd2b12Eric Laurent          [0.0, 0.0, 0.5, 10.0]}
2981784c37c61b09289654b979567a42bf73cd2b12Eric Laurent# Instantiate an example
3081784c37c61b09289654b979567a42bf73cd2b12Eric LaurentExample((input0, output0))
3181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent