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_AddN_1D)
23 int in1 = cgen.addTensor({{8}, circle::TensorType::TensorType_FLOAT32});
24 int in2 = cgen.addTensor({{8}, circle::TensorType::TensorType_FLOAT32});
25 int in3 = cgen.addTensor({{8}, circle::TensorType::TensorType_FLOAT32});
26 int out = cgen.addTensor({{8}, circle::TensorType::TensorType_FLOAT32});
28 cgen.addOperatorAddN({{in1, in2, in3}, {out}});
29 cgen.setInputsAndOutputs({in1, in2, in3}, {out});
31 _context = std::make_unique<GenModelTestContext>(cgen.finish());
32 _context->setBackends({"cpu"});
33 _context->addTestCase(uniformTCD<float>({{1.2, 2.0, -3.0, 4.5, 10.0, 5.1, -7.0, 12.0},
34 {3.3, 4.1, 3.0, 4.4, 5.0, 4.3, -1.2, 4.0},
35 {-5.2, 3.1, 2.2, -3.7, 5.2, 2.0, -4.3, 5.0}},
36 {{-0.7, 9.2, 2.2, 5.2, 20.2, 11.4, -12.5, 21.0}}));
41 TEST_F(GenModelTest, neg_OneOp_AddN_InvalidType)
45 int in1 = cgen.addTensor({{8}, circle::TensorType::TensorType_UINT8});
46 int in2 = cgen.addTensor({{8}, circle::TensorType::TensorType_UINT8});
47 int in3 = cgen.addTensor({{8}, circle::TensorType::TensorType_UINT8});
48 int out = cgen.addTensor({{8}, circle::TensorType::TensorType_UINT8});
50 cgen.addOperatorAddN({{in1, in2, in3}, {out}});
51 cgen.setInputsAndOutputs({in1, in2, in3}, {out});
53 _context = std::make_unique<GenModelTestContext>(cgen.finish());
54 _context->setBackends({"cpu"});
55 _context->expectFailModelLoad();