1 # 2 # Copyright (C) 2017 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 17 # model 18 model = Model() 19 i1 = Input("op1", "TENSOR_FLOAT32", "{2, 3}") # input tensor 0 20 i2 = Input("op2", "TENSOR_FLOAT32", "{2, 3}") # input tensor 1 21 axis0 = Int32Scalar("axis0", 0) 22 r = Output("result", "TENSOR_FLOAT32", "{4, 3}") # output 23 model = model.Operation("CONCATENATION", i1, i2, axis0).To(r) 24 25 # Example 1. 26 input0 = {i1: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0], 27 i2: [7.0, 8.0, 9.0, 10.0, 11.0, 12.0]} 28 output0 = {r: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]} 29 30 # Instantiate an example 31 Example((input0, output0)) 32