Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/dnn/src/vkcom/include/op_lrn.hpp
16350 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
4
//
5
// Copyright (C) 2018, Intel Corporation, all rights reserved.
6
// Third party copyrights are property of their respective owners.
7
8
#ifndef OPENCV_DNN_VKCOM_OP_LRN_HPP
9
#define OPENCV_DNN_VKCOM_OP_LRN_HPP
10
11
#include "vkcom.hpp"
12
#include "op_base.hpp"
13
14
namespace cv { namespace dnn { namespace vkcom {
15
16
#ifdef HAVE_VULKAN
17
18
enum LRNShaderType
19
{
20
kLRNShaderTypeBasic = 0,
21
kLRNShaderTypeNum
22
};
23
24
struct LRNShaderConfig
25
{
26
int local_size_x;
27
int local_size_y;
28
int local_size_z;
29
int block_height;
30
int block_width;
31
int block_depth;
32
LRNShaderType shader_type;
33
};
34
35
class OpLRN : public OpBase
36
{
37
public:
38
OpLRN(const int radius, const float bias,
39
const float alpha, const float beta,
40
const bool norm_by_size);
41
void reshapeOutTensor(Tensor& in, Tensor& out);
42
bool forward(Tensor& in, Tensor& out);
43
virtual bool forward(std::vector<Tensor>& ins,
44
std::vector<Tensor>& blobs,
45
std::vector<Tensor>& outs) CV_OVERRIDE;
46
47
private:
48
bool init(const int radius, const float bias,
49
const float alpha, const float beta,
50
const bool norm_by_size);
51
bool computeGroupCount();
52
int batch_;
53
int height_;
54
int width_;
55
int channels_;
56
int radius_;
57
float bias_;
58
float alpha_;
59
float beta_;
60
int filter_len_;
61
int thread_num_;
62
bool norm_by_size_;
63
LRNShaderConfig config_;
64
};
65
66
#endif // HAVE_VULKAN
67
68
}}} // namespace cv::dnn::vkcom
69
70
#endif // OPENCV_DNN_VKCOM_OP_LRN_HPP
71
72