blob: 4245b650e234a5eb281f03e39be5980b55fb547f [file] [log] [blame]
Anthony Barbier8140e1e2017-12-14 23:48:46 +00001/*
Anthony Barbier06ea0482018-02-22 15:45:35 +00002 * Copyright (c) 2017-2018 ARM Limited.
Anthony Barbier8140e1e2017-12-14 23:48:46 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/runtime/NEON/functions/NEIm2Col.h"
25
Jenkinsb3a371b2018-05-23 11:36:53 +010026#include "arm_compute/core/TensorInfo.h"
27#include "arm_compute/runtime/NEON/NEScheduler.h"
Anthony Barbier8140e1e2017-12-14 23:48:46 +000028#include "support/ToolchainSupport.h"
29
30using namespace arm_compute;
31
Jenkinsb3a371b2018-05-23 11:36:53 +010032NEIm2Col::NEIm2Col()
33 : _kernel(), _y_dim(1)
Anthony Barbier8140e1e2017-12-14 23:48:46 +000034{
Anthony Barbier8140e1e2017-12-14 23:48:46 +000035}
36
Jenkins52ba29e2018-08-29 15:32:11 +000037void NEIm2Col::configure(const ITensor *input, ITensor *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation, unsigned int num_groups,
38 bool is_fully_connected, bool is_flatten)
Anthony Barbier8140e1e2017-12-14 23:48:46 +000039{
Jenkinsb3a371b2018-05-23 11:36:53 +010040 _y_dim = get_data_layout_dimension_index(input->info()->data_layout(), DataLayoutDimension::HEIGHT);
41
Jenkins52ba29e2018-08-29 15:32:11 +000042 _kernel.configure(input, output, kernel_dims, conv_info, has_bias, dilation, num_groups, is_fully_connected, is_flatten);
Jenkinsb3a371b2018-05-23 11:36:53 +010043}
44
Jenkins52ba29e2018-08-29 15:32:11 +000045Status NEIm2Col::validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation,
46 unsigned int num_groups, bool is_fully_connected, bool is_flatten)
Jenkinsb3a371b2018-05-23 11:36:53 +010047{
Jenkins52ba29e2018-08-29 15:32:11 +000048 return NEIm2ColKernel::validate(input, output, kernel_dims, conv_info, has_bias, dilation, num_groups, is_fully_connected, is_flatten);
Jenkinsb3a371b2018-05-23 11:36:53 +010049}
50
51void NEIm2Col::run()
52{
53 NEScheduler::get().schedule(&_kernel, _y_dim);
Anthony Barbier8140e1e2017-12-14 23:48:46 +000054}