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_ReverseV2_3D)
23 int in = cgen.addTensor({{4, 3, 2}, circle::TensorType::TensorType_FLOAT32});
24 std::vector<int32_t> axis_data{1};
25 uint32_t axis_buf = cgen.addBuffer(axis_data);
26 int axis = cgen.addTensor({{1}, circle::TensorType::TensorType_INT32, axis_buf});
27 int out = cgen.addTensor({{4, 3, 2}, circle::TensorType::TensorType_FLOAT32});
29 cgen.addOperatorReverseV2({{in, axis}, {out}});
30 cgen.setInputsAndOutputs({in}, {out});
32 _context = std::make_unique<GenModelTestContext>(cgen.finish());
33 _context->setBackends({"acl_cl", "cpu"});
34 _context->addTestCase(uniformTCD<float>(
35 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}},
36 {{5, 6, 3, 4, 1, 2, 11, 12, 9, 10, 7, 8, 17, 18, 15, 16, 13, 14, 23, 24, 21, 22, 19, 20}}));
41 TEST_F(GenModelTest, OneOp_ReverseV2_1D)
45 int in = cgen.addTensor({{4}, circle::TensorType::TensorType_FLOAT32});
46 std::vector<int32_t> axis_data{0};
47 uint32_t axis_buf = cgen.addBuffer(axis_data);
48 int axis = cgen.addTensor({{1}, circle::TensorType::TensorType_INT32, axis_buf});
49 int out = cgen.addTensor({{4}, circle::TensorType::TensorType_FLOAT32});
51 cgen.addOperatorReverseV2({{in, axis}, {out}});
52 cgen.setInputsAndOutputs({in}, {out});
54 _context = std::make_unique<GenModelTestContext>(cgen.finish());
55 _context->setBackends({"acl_cl", "cpu"});
56 _context->addTestCase(uniformTCD<float>({{1, 2, 3, 4}}, {{4, 3, 2, 1}}));