summaryrefslogtreecommitdiff
path: root/libs/kernel/acl/src/neon/Conv2D.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/kernel/acl/src/neon/Conv2D.test.cpp')
-rw-r--r--libs/kernel/acl/src/neon/Conv2D.test.cpp202
1 files changed, 0 insertions, 202 deletions
diff --git a/libs/kernel/acl/src/neon/Conv2D.test.cpp b/libs/kernel/acl/src/neon/Conv2D.test.cpp
deleted file mode 100644
index 6a3de1c43..000000000
--- a/libs/kernel/acl/src/neon/Conv2D.test.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include <OperationsUtils.h>
-#include <kernel/acl/nnfw_kernel_acl.h>
-#include <kernel/acl/Conv2D.h>
-
-// TODO: fix include path in CMakeFiles
-#include "../util.h"
-
-using namespace nnfw::kernel::acl;
-
-TEST(KernelACL_TC, neon_convFloat32_3x3to1x1)
-{
- float inputData[9];
- const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
- float filterData[9];
- const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
- float biasData[1] = { 1.0 };
- const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
- int32_t padding_left = 0;
- int32_t padding_right = 0;
- int32_t padding_top = 0;
- int32_t padding_bottom = 0;
- int32_t stride_width = 1;
- int32_t stride_height = 1;
- int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
- float outputData[1];
- const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
- bool bret;
-
- util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
- util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
- util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
-
- bret = neon::convFloat32(inputData, inputShape,
- filterData, filterShape,
- biasData, biasShape,
- padding_left, padding_right,
- padding_top, padding_bottom,
- stride_width, stride_height,
- activation,
- outputData, outputShape);
- EXPECT_EQ(bret, true);
-
- float expectData[] = { 10.0f };
- bret = util::compareData(outputData, expectData, outputShape);
- EXPECT_EQ(bret, true);
-}
-
-TEST(KernelACL_TC, neon_convFloat32_3x3to3x3)
-{
- float inputData[9];
- const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
- float filterData[9];
- const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
- float biasData[1] = { 1.0 };
- const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
- int32_t padding_left = 1;
- int32_t padding_right = 1;
- int32_t padding_top = 1;
- int32_t padding_bottom = 1;
- int32_t stride_width = 1;
- int32_t stride_height = 1;
- int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
- float outputData[9];
- const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
- bool bret;
-
- util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
- util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
- util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
-
- bret = neon::convFloat32(inputData, inputShape,
- filterData, filterShape,
- biasData, biasShape,
- padding_left, padding_right,
- padding_top, padding_bottom,
- stride_width, stride_height,
- activation,
- outputData, outputShape);
- EXPECT_EQ(bret, true);
-
- float expectData[] = {
- 5.0f, 7.0f, 5.0f,
- 7.0f, 10.0f, 7.0f,
- 5.0f, 7.0f, 5.0f
- };
- bret = util::compareData(outputData, expectData, outputShape);
- EXPECT_EQ(bret, true);
-}
-
-TEST(KernelACL_TC, neon_convFloat32_3x3to3x3_RELU)
-{
- float inputData[9];
- const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
- float filterData[9];
- const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
- float biasData[1] = { -5.0f };
- const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
- int32_t padding_left = 1;
- int32_t padding_right = 1;
- int32_t padding_top = 1;
- int32_t padding_bottom = 1;
- int32_t stride_width = 1;
- int32_t stride_height = 1;
- int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
- float outputData[9];
- const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
- bool bret;
-
- util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
- util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
- util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
-
- bret = neon::convFloat32(inputData, inputShape,
- filterData, filterShape,
- biasData, biasShape,
- padding_left, padding_right,
- padding_top, padding_bottom,
- stride_width, stride_height,
- activation,
- outputData, outputShape);
- EXPECT_EQ(bret, true);
-
- float expectData[] =
- {
- 0.0f, 1.0f, 0.0f,
- 1.0f, 4.0f, 1.0f,
- 0.0f, 1.0f, 0.0f
- };
-
- bret = util::compareData(outputData, expectData, outputShape);
- EXPECT_EQ(bret, true);
-}
-
-TEST(KernelACL_TC, neon_convFloat32_3x5to3x3)
-{
- float inputData[15] = {
- 1,2,3,4,5,
- 6,7,8,9,10,
- 11,12,13,14,15
- };
- const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,5,1}, 1.0, 0 };
- float filterData[18] = {
- 1,1,1, 1,1,1, 1,1,1,
- 2,2,2, 2,2,2, 2,2,2
- };
- const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {2,3,3,1}, 1.0, 0 };
- float biasData[2] = { 1.0, 1.0 };
- const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {2}, 1.0, 0 };
- int32_t padding_left = 1;
- int32_t padding_right = 1;
- int32_t padding_top = 1;
- int32_t padding_bottom = 1;
- int32_t stride_width = 1;
- int32_t stride_height = 1;
- int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
- float outputData[30];
- const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,5,2}, 1.0, 0 };
- bool bret;
-
- util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
-
- bret = neon::convFloat32(inputData, inputShape,
- filterData, filterShape,
- biasData, biasShape,
- padding_left, padding_right,
- padding_top, padding_bottom,
- stride_width, stride_height,
- activation,
- outputData, outputShape);
- EXPECT_EQ(bret, true);
-
- float expectNCHW[] = {
- 17.0f, 28.0f, 34.0f, 40.0f, 29.0f,
- 40.0f, 64.0f, 73.0f, 82.0f, 58.0f,
- 37.0f, 58.0f, 64.0f, 70.0f, 49.0f,
-
- 33.0f, 55.0f, 67.0f, 79.0f, 57.0f,
- 79.0f, 127.0f, 145.0f, 163.0f, 115.0f,
- 73.0f, 115.0f, 127.0f, 139.0f, 97.0f
- };
- float expectData[30];
- util::NCHW2NHWC(expectNCHW, expectData, outputShape);
- bret = util::compareData(outputData, expectData, outputShape);
- EXPECT_EQ(bret, true);
-}