Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/dnn/src/vkcom/include/op_permute.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_PERMUTE_HPP
9
#define OPENCV_DNN_VKCOM_OP_PERMUTE_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
class OpPermute: public OpBase
19
{
20
public:
21
OpPermute(std::vector<size_t>& order);
22
bool forward(std::vector<Tensor>& ins, std::vector<Tensor>& outs);
23
void reshapeOutTensor(std::vector<Tensor *>& in, std::vector<Tensor>& outs);
24
virtual bool forward(std::vector<Tensor>& ins,
25
std::vector<Tensor>& blobs,
26
std::vector<Tensor>& outs) CV_OVERRIDE;
27
28
private:
29
void prepareStrides(const Shape &shape_before, const Shape &shape_after);
30
bool computeGroupCount();
31
32
std::vector<int> order_;
33
bool need_permute_;
34
int global_size_;
35
int nthreads_;
36
int dims_;
37
Tensor tensor_order_;
38
Tensor tensor_old_stride_;
39
Tensor tensor_new_stride_;
40
std::vector<int> old_stride_;
41
std::vector<int> new_stride_;
42
Shape in_shape_;
43
Shape out_shape_;
44
};
45
46
#endif // HAVE_VULKAN
47
48
}}} // namespace cv::dnn::vkcom
49
50
#endif // OPENCV_DNN_VKCOM_OP_PERMUTE_HPP
51
52