119d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# 219d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# Copyright (C) 2017 The Android Open Source Project 319d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# 419d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# Licensed under the Apache License, Version 2.0 (the "License"); 519d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# you may not use this file except in compliance with the License. 619d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# You may obtain a copy of the License at 719d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# 819d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# http://www.apache.org/licenses/LICENSE-2.0 919d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# 1019d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# Unless required by applicable law or agreed to in writing, software 1119d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# distributed under the License is distributed on an "AS IS" BASIS, 1219d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1319d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# See the License for the specific language governing permissions and 1419d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# limitations under the License. 1519d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# 1619d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen 1719d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# model 1819d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chenmodel = Model() 1919d9a2b88298b92548f84b7faff3a113eb1e6462Dong Cheni1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{1, 3, 3, 1}, 0.5f, 0") 2019d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chencons1 = Int32Scalar("cons1", 1) 2119d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chenpad0 = Int32Scalar("pad0", 0) 2219d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chenact2 = Int32Scalar("relu1_activitation", 2) 2319d9a2b88298b92548f84b7faff3a113eb1e6462Dong Cheno = Output("op3", "TENSOR_QUANT8_ASYMM", "{1, 3, 3, 1}, 0.5f, 0") 2419d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chenmodel = model.Operation("AVERAGE_POOL_2D", i1, pad0, pad0, pad0, pad0, cons1, cons1, cons1, cons1, act2).To(o) 2519d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen 2619d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# Example 1. Input in operand 0, 2719d9a2b88298b92548f84b7faff3a113eb1e6462Dong Cheninput0 = {i1: # input 0 2819d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen [0, 1, 2, 3, 4, 5, 6, 7, 8]} 2919d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen 3019d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chenoutput0 = {o: # output 0 3119d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen [0, 1, 2, 2, 2, 2, 2, 2, 2]} 3219d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen 3319d9a2b88298b92548f84b7faff3a113eb1e6462Dong Chen# Instantiate an example 3419d9a2b88298b92548f84b7faff3a113eb1e6462Dong ChenExample((input0, output0)) 35