bool supportBackend(int backendId, int)
{
return backendId == DNN_BACKEND_OPENCV ||
- backendId == DNN_BACKEND_HALIDE;
+ backendId == DNN_BACKEND_CUDA ||
+ backendId == DNN_BACKEND_HALIDE || backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH;;
}
void apply(const float* srcptr, float* dstptr, int len, size_t planeSize, int cn0, int cn1) const
bool supportBackend(int backendId, int)
{
return backendId == DNN_BACKEND_OPENCV ||
- backendId == DNN_BACKEND_HALIDE;
+ backendId == DNN_BACKEND_CUDA ||
+ backendId == DNN_BACKEND_HALIDE || backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH;
}
void apply(const float* srcptr, float* dstptr, int len, size_t planeSize, int cn0, int cn1) const
virtual bool supportBackend(int backendId) CV_OVERRIDE
{
return backendId == DNN_BACKEND_OPENCV ||
- backendId == DNN_BACKEND_HALIDE ||
+ backendId == DNN_BACKEND_CUDA ||
+ (backendId == DNN_BACKEND_HALIDE && op != DIV) || // TODO: not implemented, see PR #15811
((((backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && (preferableTarget != DNN_TARGET_OPENCL || coeffs.empty()))
- || backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && !variableChannels));
+ || backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && channelsMode == ELTWISE_CHANNNELS_SAME));
}
bool getMemoryShapes(const std::vector<MatShape> &inputs,
CV_Assert(outputs.size() == 1);
const int nstripes = getNumThreads();
- EltwiseInvoker::run(&inputs[0], (int)inputs.size(), outputs[0],
- coeffs, op, activ.get(), nstripes);
+ EltwiseInvoker::run(*this,
+ &inputs[0], (int)inputs.size(), outputs[0],
+ nstripes);
}
+#ifdef HAVE_CUDA
+ Ptr<BackendNode> initCUDA(
+ void *context_,
+ const std::vector<Ptr<BackendWrapper>>& inputs,
+ const std::vector<Ptr<BackendWrapper>>& outputs
+ ) override
+ {
+ auto context = reinterpret_cast<csl::CSLContext*>(context_);
+
+ auto op_ = [this] {
+ switch (op) {
+ case MAX: return cuda4dnn::EltwiseOpType::MAX;
+ case SUM: return cuda4dnn::EltwiseOpType::SUM;
+ case PROD: return cuda4dnn::EltwiseOpType::PRODUCT;
+ case DIV: return cuda4dnn::EltwiseOpType::DIV;
+ }
+ return cuda4dnn::EltwiseOpType::SUM;
+ }();
+
+ return make_cuda_node<cuda4dnn::EltwiseOp>(preferableTarget, std::move(context->stream), op_, coeffs);
+ }
+#endif
+
virtual Ptr<BackendNode> initHalide(const std::vector<Ptr<BackendWrapper> > &input) CV_OVERRIDE
{
#ifdef HAVE_HALIDE