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.
5 #ifndef OPENCV_DNN_SRC_CUDA4DNN_PRIMITIVES_SPLIT_HPP
6 #define OPENCV_DNN_SRC_CUDA4DNN_PRIMITIVES_SPLIT_HPP
8 #include "../../op_cuda.hpp"
10 #include "../csl/stream.hpp"
11 #include "../csl/tensor_ops.hpp"
13 #include <opencv2/core.hpp>
17 namespace cv { namespace dnn { namespace cuda4dnn {
20 class SplitOp final : public CUDABackendNode {
22 using wrapper_type = GetCUDABackendWrapperType<T>;
24 SplitOp(csl::Stream stream_)
25 : stream(std::move(stream_))
30 const std::vector<cv::Ptr<BackendWrapper>>& inputs,
31 const std::vector<cv::Ptr<BackendWrapper>>& outputs,
32 csl::Workspace& workspace) override
34 CV_Assert(inputs.size() == 1);
36 auto input_wrapper = inputs[0].dynamicCast<wrapper_type>();
37 auto input = input_wrapper->getView();
39 for (int i = 0; i < outputs.size(); i++)
41 auto output_wrapper = outputs[i].dynamicCast<wrapper_type>();
42 auto output = output_wrapper->getSpan();
44 csl::tensor_ops::copy<T>(stream, output, input);
52 }}} /* namespace cv::dnn::cuda4dnn */
54 #endif /* OPENCV_DNN_SRC_CUDA4DNN_PRIMITIVES_SPLIT_HPP */