2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
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 #include "GenModelTest.h"
19 TEST_F(GenModelTest, OneOp_Equal)
22 int lhs = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_FLOAT32});
23 int rhs = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_FLOAT32});
24 int out = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_BOOL});
25 cgen.addOperatorEqual({{lhs, rhs}, {out}});
26 cgen.setInputsAndOutputs({lhs, rhs}, {out});
28 _context = std::make_unique<GenModelTestContext>(cgen.finish());
29 _context->addTestCase(TestCaseData{}
30 .addInput<float>({0.1, 0.3, 0.5, 0.7})
31 .addInput<float>({0.1, 0.2, 0.3, 0.4})
32 .addOutput<bool>({true, false, false, false}));
33 _context->setBackends({"acl_cl", "acl_neon", "cpu"});
38 TEST_F(GenModelTest, neg_OneOp_Equal_DifferentType)
41 int lhs = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_FLOAT32});
42 int rhs = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_INT32});
43 int out = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_BOOL});
44 cgen.addOperatorEqual({{lhs, rhs}, {out}});
45 cgen.setInputsAndOutputs({lhs, rhs}, {out});
47 _context = std::make_unique<GenModelTestContext>(cgen.finish());
48 _context->setBackends({"acl_cl", "acl_neon", "cpu"});
49 _context->expectFailModelLoad();
54 TEST_F(GenModelTest, neg_OneOp_Equal_InvalidType)
57 int lhs = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_FLOAT32});
58 int rhs = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_FLOAT32});
59 int out = cgen.addTensor({{1, 2, 2, 1}, circle::TensorType::TensorType_INT32});
60 cgen.addOperatorEqual({{lhs, rhs}, {out}});
61 cgen.setInputsAndOutputs({lhs, rhs}, {out});
63 _context = std::make_unique<GenModelTestContext>(cgen.finish());
64 _context->setBackends({"acl_cl", "acl_neon", "cpu"});
65 _context->expectFailModelLoad();