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# 16base = Input("base", "TENSOR_FLOAT32", "{2, 1}") 17 18exponents = [Input("exponent", "TENSOR_FLOAT32", "{1}"), 19 Input("exponent", "TENSOR_FLOAT32", "{1, 2}"), 20 Input("exponent", "TENSOR_FLOAT32", "{3, 1, 2}")] 21 22outputs = [Output("output", "TENSOR_FLOAT32", "{2, 1}"), 23 Output("output", "TENSOR_FLOAT32", "{2, 2}"), 24 Output("output", "TENSOR_FLOAT32", "{3, 2, 2}")] 25 26base_data = [2., 3.] 27exponents_data = [[2.], 28 [2., 3.], 29 [0., 0.5, 1., 2., 3., 4.]] 30 31outputs_data = [[4., 9.], 32 [4., 8., 9., 27.], 33 [1., 2 ** 0.5, 1., 3 ** 0.5, 2., 4., 3., 9., 8., 16., 27., 81.]] 34 35for exponent, output, exponent_data, output_data in zip(exponents, outputs, exponents_data, outputs_data): 36 model = Model().Operation("POW", base, exponent).To(output) 37 Example({ 38 base: base_data, 39 exponent: exponent_data, 40 output: output_data 41 }, model=model).AddVariations("relaxed", "float16") 42