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_Split)
22 int in = cgen.addTensor({{2, 4}, circle::TensorType::TensorType_FLOAT32});
23 std::vector<int32_t> axis_data{1};
24 uint32_t axis_buf = cgen.addBuffer(axis_data);
25 int axis = cgen.addTensor({{1}, circle::TensorType::TensorType_INT32, axis_buf});
27 int out1 = cgen.addTensor({{2, 2}, circle::TensorType::TensorType_FLOAT32});
28 int out2 = cgen.addTensor({{2, 2}, circle::TensorType::TensorType_FLOAT32});
30 cgen.addOperatorSplit({{axis, in}, {out1, out2}}, 2);
31 cgen.setInputsAndOutputs({in}, {out1, out2});
33 _context = std::make_unique<GenModelTestContext>(cgen.finish());
34 _context->addTestCase(
35 uniformTCD<float>({{1, 2, 3, 4, 5, 6, 7, 8}}, {{1, 2, 5, 6}, {3, 4, 7, 8}}));
36 _context->setBackends({"cpu", "acl_cl", "acl_neon"});
41 TEST_F(GenModelTest, OneOp_SplitNonConstAxis)
44 int in = cgen.addTensor({{2, 4}, circle::TensorType::TensorType_FLOAT32});
45 int axis = cgen.addTensor({{1}, circle::TensorType::TensorType_INT32});
47 int out1 = cgen.addTensor({{2, 2}, circle::TensorType::TensorType_FLOAT32});
48 int out2 = cgen.addTensor({{2, 2}, circle::TensorType::TensorType_FLOAT32});
50 cgen.addOperatorSplit({{axis, in}, {out1, out2}}, 2);
51 cgen.setInputsAndOutputs({axis, in}, {out1, out2});
53 _context = std::make_unique<GenModelTestContext>(cgen.finish());
54 _context->addTestCase(TestCaseData{}
55 .addInput<int32_t>({1})
56 .addInput<float>({1, 2, 3, 4, 5, 6, 7, 8})
57 .addOutput<float>({1, 2, 5, 6})
58 .addOutput<float>({3, 4, 7, 8}));
59 _context->setBackends({"cpu"});