Home | History | Annotate | Download | only in V1_2
      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 
     17 def test(name, input0, input1, output0, input0_data, input1_data, output_data):
     18   model = Model().Operation("LOGICAL_AND", input0, input1).To(output0)
     19   Example({
     20       input0: input0_data,
     21       input1: input1_data,
     22       output0: output_data,
     23   }, model=model, name=name)
     24 
     25 test(
     26     name="simple",
     27     input0=Input("input0", "TENSOR_BOOL8", "{1, 1, 1, 4}"),
     28     input1=Input("input1", "TENSOR_BOOL8", "{1, 1, 1, 4}"),
     29     output0=Output("output0", "TENSOR_BOOL8", "{1, 1, 1, 4}"),
     30     input0_data=[True, False, False, True],
     31     input1_data=[True, False, True, False],
     32     output_data=[True, False, False, False],
     33 )
     34 
     35 test(
     36     name="broadcast",
     37     input0=Input("input0", "TENSOR_BOOL8", "{1, 1, 1, 4}"),
     38     input1=Input("input1", "TENSOR_BOOL8", "{1, 1}"),
     39     output0=Output("output0", "TENSOR_BOOL8", "{1, 1, 1, 4}"),
     40     input0_data=[True, False, False, True],
     41     input1_data=[True],
     42     output_data=[True, False, False, True],
     43 )
     44