mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge pull request #27816 from abhishek-gola:reduce_layer
Extended Reduce layer support in new DNN engine #27816 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -439,6 +439,30 @@ CV__DNN_INLINE_NS_BEGIN
|
||||
static Ptr<ReduceLayer> create(const LayerParams& params);
|
||||
};
|
||||
|
||||
class CV_EXPORTS Reduce2Layer : public Layer
|
||||
{
|
||||
public:
|
||||
enum class ReduceType
|
||||
{
|
||||
MAX,
|
||||
MIN,
|
||||
MEAN,
|
||||
SUM,
|
||||
L1,
|
||||
L2,
|
||||
PROD,
|
||||
SUM_SQUARE,
|
||||
LOG_SUM,
|
||||
LOG_SUM_EXP
|
||||
};
|
||||
ReduceType reduce_type;
|
||||
bool keepdims;
|
||||
bool noop_with_empty_axes;
|
||||
std::vector<int> axes;
|
||||
|
||||
static Ptr<Reduce2Layer> create(const LayerParams& params);
|
||||
};
|
||||
|
||||
class CV_EXPORTS SoftmaxLayer : public Layer
|
||||
{
|
||||
public:
|
||||
@@ -782,12 +806,12 @@ CV__DNN_INLINE_NS_BEGIN
|
||||
class CV_EXPORTS ActivationLayer : public Layer
|
||||
{
|
||||
public:
|
||||
virtual void forwardSlice(const float* src, float* dst, int len,
|
||||
size_t outPlaneSize, int cn0, int cn1) const {}
|
||||
virtual void forwardSlice(const int* src, const int* lut, int* dst, int len,
|
||||
size_t outPlaneSize, int cn0, int cn1) const {}
|
||||
virtual void forwardSlice(const int8_t* src, const int8_t* lut, int8_t* dst, int len,
|
||||
size_t outPlaneSize, int cn0, int cn1) const {}
|
||||
virtual void forwardSlice(const float*, float*, int,
|
||||
size_t, int, int) const {}
|
||||
virtual void forwardSlice(const int*, const int*, int*, int,
|
||||
size_t, int, int) const {}
|
||||
virtual void forwardSlice(const int8_t*, const int8_t*, int8_t*, int,
|
||||
size_t, int, int) const {}
|
||||
};
|
||||
|
||||
class CV_EXPORTS ReLULayer : public ActivationLayer
|
||||
|
||||
Reference in New Issue
Block a user