2 * Copyright (c) 2021 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_Relu)
22 int in = cgen.addTensor({{2, 3}, circle::TensorType::TensorType_FLOAT32});
23 int out = cgen.addTensor({{2, 3}, circle::TensorType::TensorType_FLOAT32});
24 cgen.addOperatorRelu({{in}, {out}});
25 cgen.setInputsAndOutputs({in}, {out});
27 _context = std::make_unique<GenModelTestContext>(cgen.finish());
28 _context->addTestCase(
29 uniformTCD<float>({{0, 1.0, 3.0, 1.0, -1.0, -2.0f}}, {{0, 1.0, 3.0, 1.0, 0, 0}}));
30 _context->setBackends({"cpu", "gpu_cl"});
35 TEST_F(GenModelTest, neg_OneOp_Relu_InvalidType)
38 int in = cgen.addTensor({{2, 3}, circle::TensorType::TensorType_UINT8});
39 int out = cgen.addTensor({{2, 3}, circle::TensorType::TensorType_FLOAT32});
40 cgen.addOperatorRelu({{in}, {out}});
41 cgen.setInputsAndOutputs({in}, {out});
43 _context = std::make_unique<GenModelTestContext>(cgen.finish());
44 _context->setBackends({"cpu", "gpu_cl"});
45 _context->expectFailModelLoad();