2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
6 #include <backends/aclCommon/ArmComputeTensorUtils.hpp>
7 #include <backends/cl/ClWorkloadFactory.hpp>
8 #include <backends/neon/NeonWorkloadFactory.hpp>
10 #if ARMCOMPUTECL_ENABLED && ARMCOMPUTENEON_ENABLED
11 #include <backends/aclCommon/test/MemCopyTestImpl.hpp>
12 #include <backends/cl/test/ClContextControlFixture.hpp>
15 #include <boost/test/unit_test.hpp>
17 BOOST_AUTO_TEST_SUITE(MemCopyCommon)
19 BOOST_AUTO_TEST_CASE(AclTypeConversions)
21 arm_compute::Strides strides(1, 2, 3, 4);
22 armnn::TensorShape convertedStrides = armnn::armcomputetensorutils::GetStrides(strides);
24 BOOST_TEST(convertedStrides[0] == 4);
25 BOOST_TEST(convertedStrides[1] == 3);
26 BOOST_TEST(convertedStrides[2] == 2);
27 BOOST_TEST(convertedStrides[3] == 1);
29 arm_compute::TensorShape shape(5, 6, 7, 8);
30 armnn::TensorShape convertedshape = armnn::armcomputetensorutils::GetShape(shape);
32 BOOST_TEST(convertedshape[0] == 8);
33 BOOST_TEST(convertedshape[1] == 7);
34 BOOST_TEST(convertedshape[2] == 6);
35 BOOST_TEST(convertedshape[3] == 5);
38 BOOST_AUTO_TEST_SUITE_END()
40 #if ARMCOMPUTECL_ENABLED && ARMCOMPUTENEON_ENABLED
42 BOOST_FIXTURE_TEST_SUITE(MemCopyClNeon, ClContextControlFixture)
44 BOOST_AUTO_TEST_CASE(CopyBetweenNeonAndGpu)
46 LayerTestResult<float, 4> result = MemCopyTest<armnn::NeonWorkloadFactory, armnn::ClWorkloadFactory>(false);
47 BOOST_TEST(CompareTensors(result.output, result.outputExpected));
50 BOOST_AUTO_TEST_CASE(CopyBetweenGpuAndNeon)
52 LayerTestResult<float, 4> result = MemCopyTest<armnn::ClWorkloadFactory, armnn::NeonWorkloadFactory>(false);
53 BOOST_TEST(CompareTensors(result.output, result.outputExpected));
56 BOOST_AUTO_TEST_CASE(CopyBetweenNeonAndGpuWithSubtensors)
58 LayerTestResult<float, 4> result = MemCopyTest<armnn::NeonWorkloadFactory, armnn::ClWorkloadFactory>(true);
59 BOOST_TEST(CompareTensors(result.output, result.outputExpected));
62 BOOST_AUTO_TEST_CASE(CopyBetweenGpuAndNeonWithSubtensors)
64 LayerTestResult<float, 4> result = MemCopyTest<armnn::ClWorkloadFactory, armnn::NeonWorkloadFactory>(true);
65 BOOST_TEST(CompareTensors(result.output, result.outputExpected));
68 BOOST_AUTO_TEST_SUITE_END()