Path: blob/master/modules/dnn/src/vkcom/include/op_conv.hpp
16344 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.3//4// Copyright (C) 2018, Intel Corporation, all rights reserved.5// Third party copyrights are property of their respective owners.67#ifndef OPENCV_DNN_VKCOM_OP_CONV_HPP8#define OPENCV_DNN_VKCOM_OP_CONV_HPP910#include "vkcom.hpp"11#include "op_base.hpp"1213namespace cv { namespace dnn { namespace vkcom {1415#ifdef HAVE_VULKAN1617enum ConvShaderType18{19kConvShaderTypeBasic = 0,20kConvShaderTypeIDLF = 1,21kConvShaderTypeNum22};2324struct ConvShaderConfig25{26int local_size_x;27int local_size_y;28int local_size_z;29int block_height;30int block_width;31int block_depth;32ConvShaderType shader_type;33};3435class OpConv : public OpBase36{37public:38OpConv(const int out_channel, const bool has_bias,39const int* filter_size, const int* pad,40const int* stride, const int* dilation,41const int activation, const int group,42const int padding_mode);43void reshapeOutTensor(Tensor& in, Tensor& out);44bool forward(Tensor& in, Tensor& filter_weights, Tensor& bias, Tensor& out);45virtual bool forward(std::vector<Tensor>& ins,46std::vector<Tensor>& blobs,47std::vector<Tensor>& outs) CV_OVERRIDE;48private:49bool init(const int out_channel, const bool has_bias,50const int* filter_size, const int* pad,51const int* stride, const int* dilation,52const int activation, const int group,53const int padding_mode);54bool computeGroupCount();5556int batch_;57int in_height_;58int in_width_;59int in_channel_;60int out_height_;61int out_width_;62int out_channel_;63int filter_height_;64int filter_width_;65int stride_height_;66int stride_width_;67int padding_top_;68int padding_left_;69int dilation_height_;70int dilation_width_;71int activation_;72PaddingMode padding_mode_;73int group_;74int has_bias_;75Tensor swizzled_weights;76ConvShaderConfig config_;77bool dwconv_;78};7980#endif // HAVE_VULKAN8182}}} // namespace cv::dnn::vkcom8384#endif // OPENCV_DNN_VKCOM_OP_CONV_HPP858687