From 3ce3ff4e7133942e75fceae8f317104644d88bea Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Fri, 21 Jul 2017 17:41:02 +0100 Subject: COMPMID-415: Move DepthConcatenateLayer to new validation Change-Id: I3e594d5800f563ba9af3195b7db2b6d3e32012dd Reviewed-on: http://mpd-gerrit.cambridge.arm.com/81340 Reviewed-by: Anthony Barbier Tested-by: Kaizen --- tests/validation/CL/DepthConcatenateLayer.cpp | 200 -------------------------- 1 file changed, 200 deletions(-) delete mode 100644 tests/validation/CL/DepthConcatenateLayer.cpp (limited to 'tests/validation/CL/DepthConcatenateLayer.cpp') diff --git a/tests/validation/CL/DepthConcatenateLayer.cpp b/tests/validation/CL/DepthConcatenateLayer.cpp deleted file mode 100644 index 8e254d2bd8..0000000000 --- a/tests/validation/CL/DepthConcatenateLayer.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "AssetsLibrary.h" -#include "CL/CLAccessor.h" -#include "Globals.h" -#include "PaddingCalculator.h" -#include "TypePrinter.h" -#include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Helpers.h" -#include "validation/Reference.h" -#include "validation/Validation.h" - -#include "arm_compute/core/Helpers.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLScheduler.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLDepthConcatenate.h" - -#include "support/ToolchainSupport.h" - -#include "boost_wrapper.h" - -#include -#include -#include -#include -#include - -using namespace arm_compute; -using namespace arm_compute::test; -using namespace arm_compute::test::validation; - -namespace -{ -/** Compute OpenCL depth concatenate layer function. - * - * @param[in] shapes List of shapes to concatenate - * @param[in] dt Datatype of tensors - * @param[in] fixed_point_position (Optional) Number of bits for the fractional part of fixed point numbers. - * - * @return Computed output tensor. - */ -CLTensor compute_depth_concatenate_layer(const std::vector &shapes, DataType dt, int fixed_point_position = 0) -{ - std::vector> srcs{}; - TensorShape dst_shape = calculate_depth_concatenate_shape(shapes); - - // Create tensors - for(unsigned int i = 0; i < shapes.size(); ++i) - { - srcs.push_back(support::cpp14::make_unique()); - srcs[i]->allocator()->init(TensorInfo(shapes[i], 1, dt, fixed_point_position)); - } - CLTensor dst = create_tensor(dst_shape, dt, 1, fixed_point_position); - - // Create a vector of raw pointer - std::vector srcs_raw{}; - srcs_raw.resize(srcs.size()); - std::transform(srcs.begin(), srcs.end(), srcs_raw.begin(), [](std::unique_ptr const & t) - { - return t.get(); - }); - - // Create and configure function - CLDepthConcatenate depth_concat; - depth_concat.configure(srcs_raw, &dst); - - // Allocate tensors - for(auto &t : srcs) - { - t->allocator()->allocate(); - } - dst.allocator()->allocate(); - - for(const auto &t : srcs) - { - BOOST_TEST(!t->info()->is_resizable()); - } - BOOST_TEST(!dst.info()->is_resizable()); - - // Fill tensors - for(unsigned int i = 0; i < srcs.size(); ++i) - { - library->fill_tensor_uniform(CLAccessor(*srcs[i]), i); - } - - // Compute function - depth_concat.run(); - return dst; -} -} // namespace - -#ifndef DOXYGEN_SKIP_THIS -BOOST_AUTO_TEST_SUITE(CL) -BOOST_AUTO_TEST_SUITE(DepthConcatenateLayer) - -BOOST_AUTO_TEST_SUITE(Float) -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) -BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * CNNFloatDataTypes(), shape, dt) -{ - // Create input shapes - std::vector depths = { 4, 6, 11, 13 }; - std::vector shapes(depths.size(), shape); - for(unsigned int i = 0; i < shapes.size(); ++i) - { - shapes[i].set(2, depths[i]); - } - - // Compute function - CLTensor dst = compute_depth_concatenate_layer(shapes, dt); - - // Compute reference - RawTensor ref_dst = Reference::compute_reference_depth_concatenate_layer(shapes, dt); - - // Validate output - validate(CLAccessor(dst), ref_dst); -} - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) -BOOST_DATA_TEST_CASE(RunSmallPad, CNNFloatDataTypes(), dt) -{ - // Create input shapes - std::vector shapes{ TensorShape(12u, 12u, 14u, 8u), TensorShape(14u, 14u, 12u, 8u), TensorShape(16u, 16u, 11u, 8u) }; - - // Compute function - CLTensor dst = compute_depth_concatenate_layer(shapes, dt); - - // Compute reference - RawTensor ref_dst = Reference::compute_reference_depth_concatenate_layer(shapes, dt); - - // Validate output - validate(CLAccessor(dst), ref_dst); -} -BOOST_AUTO_TEST_SUITE_END() - -BOOST_AUTO_TEST_SUITE(Quantized) -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) -BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * CNNFixedPointDataTypes() * boost::unit_test::data::xrange(3, 6, 1), shape, dt, fixed_point_position) -{ - // Create input shapes - std::vector depths = { 4, 6, 11, 13 }; - std::vector shapes(depths.size(), shape); - for(unsigned int i = 0; i < shapes.size(); ++i) - { - shapes[i].set(2, depths[i]); - } - - // Compute function - CLTensor dst = compute_depth_concatenate_layer(shapes, dt, fixed_point_position); - - // Compute reference - RawTensor ref_dst = Reference::compute_reference_depth_concatenate_layer(shapes, dt, fixed_point_position); - - // Validate output - validate(CLAccessor(dst), ref_dst); -} - -BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit")) -BOOST_DATA_TEST_CASE(RunSmallPad, CNNFixedPointDataTypes() * boost::unit_test::data::xrange(3, 5, 1), dt, fixed_point_position) -{ - // Create input shapes - std::vector shapes{ TensorShape(12u, 12u, 14u, 8u), TensorShape(14u, 14u, 12u, 8u), TensorShape(16u, 16u, 11u, 8u) }; - - // Compute function - CLTensor dst = compute_depth_concatenate_layer(shapes, dt, fixed_point_position); - - // Compute reference - RawTensor ref_dst = Reference::compute_reference_depth_concatenate_layer(shapes, dt, fixed_point_position); - - // Validate output - validate(CLAccessor(dst), ref_dst); -} -BOOST_AUTO_TEST_SUITE_END() - -BOOST_AUTO_TEST_SUITE_END() -BOOST_AUTO_TEST_SUITE_END() -#endif /* DOXYGEN_SKIP_THIS */ -- cgit v1.2.1