2 # Copyright (C) 2018 The Android Open Source Project
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 input0 = Input("input0", "TENSOR_FLOAT32", "{2, 2}")
19 output0 = Output("output", "TENSOR_FLOAT32", "{1, 2, 2}")
20 output1 = Output("output", "TENSOR_FLOAT32", "{2, 1, 2}")
21 output2 = Output("output", "TENSOR_FLOAT32", "{2, 2, 1}")
24 model0 = Model().Operation("EXPAND_DIMS", input0, 0).To(output0)
25 model1 = Model().Operation("EXPAND_DIMS", input0, 1).To(output1)
26 model2 = Model().Operation("EXPAND_DIMS", input0, 2).To(output2)
27 model3 = Model().Operation("EXPAND_DIMS", input0, -1).To(output3)
29 data = [1.2, -3.4, 5.6, 7.8]
31 for model, output in [(model0, output0),
35 quant8 = DataTypeConverter().Identify({
36 input0: ["TENSOR_QUANT8_ASYMM", 0.5, 127],
37 output: ["TENSOR_QUANT8_ASYMM", 0.5, 127],
40 int32 = DataTypeConverter().Identify({
41 input0: ["TENSOR_INT32"],
42 output: ["TENSOR_INT32"],
48 }, model=model).AddVariations("relaxed", quant8, int32, "float16")