1# 2# Copyright (C) 2018 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 3, 12}") # input 0 18o1 = Output("op2", "TENSOR_FLOAT32", "{2, 2, 3, 12}") # output 0 19axis = Int32Scalar("axis", -1) # last axis 20Model().Operation("CHANNEL_SHUFFLE", i1, 3, axis).To(o1) 21 22# Additional data type 23quant8 = DataTypeConverter().Identify({ 24 i1: ("TENSOR_QUANT8_ASYMM", 0.25, 128), 25 o1: ("TENSOR_QUANT8_ASYMM", 0.25, 128) 26}) 27 28Example({ 29 i1: list(range(2*2*3*12)), 30 o1: [ 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 31 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19, 23, 32 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 33 36, 40, 44, 37, 41, 45, 38, 42, 46, 39, 43, 47, 34 48, 52, 56, 49, 53, 57, 50, 54, 58, 51, 55, 59, 35 60, 64, 68, 61, 65, 69, 62, 66, 70, 63, 67, 71, 36 72, 76, 80, 73, 77, 81, 74, 78, 82, 75, 79, 83, 37 84, 88, 92, 85, 89, 93, 86, 90, 94, 87, 91, 95, 38 96, 100, 104, 97, 101, 105, 98, 102, 106, 99, 103, 107, 39 108, 112, 116, 109, 113, 117, 110, 114, 118, 111, 115, 119, 40 120, 124, 128, 121, 125, 129, 122, 126, 130, 123, 127, 131, 41 132, 136, 140, 133, 137, 141, 134, 138, 142, 135, 139, 143] 42}).AddVariations("relaxed", quant8, "float16").AddAllDimsAndAxis(i1, o1, axis) 43