Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
ea34b2fe
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ea34b2fe
编写于
3月 24, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16888 from YashasSamaga:cuda4dnn-redundant-act-fusion-check
上级
978666c8
4e8cd462
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
29 addition
and
15 deletion
+29
-15
modules/dnn/src/cuda4dnn/csl/cudnn/cudnn.hpp
modules/dnn/src/cuda4dnn/csl/cudnn/cudnn.hpp
+10
-2
modules/dnn/src/cuda4dnn/primitives/convolution.hpp
modules/dnn/src/cuda4dnn/primitives/convolution.hpp
+19
-3
modules/dnn/src/dnn.cpp
modules/dnn/src/dnn.cpp
+0
-10
未找到文件。
modules/dnn/src/cuda4dnn/csl/cudnn/cudnn.hpp
浏览文件 @
ea34b2fe
...
...
@@ -27,13 +27,21 @@ namespace cv { namespace dnn { namespace cuda4dnn { namespace csl { namespace cu
/** @brief exception class for errors thrown by the cuDNN API */
class
cuDNNException
:
public
CUDAException
{
public:
using
CUDAException
::
CUDAException
;
cuDNNException
(
cudnnStatus_t
code
,
const
std
::
string
&
msg
,
const
std
::
string
&
func
,
const
std
::
string
&
file
,
int
line
)
:
CUDAException
(
Error
::
GpuApiCallError
,
msg
,
func
,
file
,
line
),
cudnnError
{
code
}
{
}
cudnnStatus_t
getCUDNNStatus
()
const
noexcept
{
return
cudnnError
;
}
private:
cudnnStatus_t
cudnnError
;
};
namespace
detail
{
inline
void
check
(
cudnnStatus_t
status
,
const
char
*
func
,
const
char
*
file
,
int
line
)
{
if
(
status
!=
CUDNN_STATUS_SUCCESS
)
throw
cuDNNException
(
Error
::
GpuApiCallError
,
cudnnGetErrorString
(
status
),
func
,
file
,
line
);
throw
cuDNNException
(
status
,
cudnnGetErrorString
(
status
),
func
,
file
,
line
);
}
/** get_data_type<T> returns the equivalent cudnn enumeration constant for type T */
...
...
modules/dnn/src/cuda4dnn/primitives/convolution.hpp
浏览文件 @
ea34b2fe
...
...
@@ -261,16 +261,32 @@ namespace cv { namespace dnn { namespace cuda4dnn {
input
=
transformed_input
;
}
auto
conv_scratchpad
=
allocator
.
get_instance
();
auto
output_wrapper
=
outputs
[
0
].
dynamicCast
<
wrapper_type
>
();
auto
output
=
output_wrapper
->
getSpan
();
if
(
fusion_location
==
InternalFusionLocation
::
CUDNN
)
{
convoluter
.
convolve_with_bias_activation
(
output
,
input
,
filtersTensor
,
biasTensor
,
allocator
.
get_instance
());
try
{
convoluter
.
convolve_with_bias_activation
(
output
,
input
,
filtersTensor
,
biasTensor
,
conv_scratchpad
);
}
catch
(
const
csl
::
cudnn
::
cuDNNException
&
ex
)
{
if
(
ex
.
getCUDNNStatus
()
==
CUDNN_STATUS_NOT_SUPPORTED
)
{
/* drop cuDNN fusion and use the native fusion path */
fusion_location
=
InternalFusionLocation
::
NATIVE
;
}
else
throw
;
}
}
if
(
fusion_location
==
InternalFusionLocation
::
NATIVE
)
{
convoluter
.
convolve
(
output
,
input
,
filtersTensor
,
allocator
.
get_instance
()
);
convoluter
.
convolve
(
output
,
input
,
filtersTensor
,
conv_scratchpad
);
if
(
!
biasTensor
.
empty
())
{
std
::
size_t
inner_size
=
output
.
size_range
(
2
,
output
.
rank
());
...
...
modules/dnn/src/dnn.cpp
浏览文件 @
ea34b2fe
...
...
@@ -2580,16 +2580,6 @@ struct Net::Impl
nextData
->
type
!=
"Power"
)
break
;
if
(
IS_DNN_CUDA_TARGET
(
preferableTarget
)
&&
nextData
->
type
!=
"ReLU"
&&
nextData
->
type
!=
"ReLU6"
&&
nextData
->
type
!=
"Power"
&&
nextData
->
type
!=
"TanH"
&&
nextData
->
type
!=
"Sigmoid"
&&
nextData
->
type
!=
"Swish"
&&
nextData
->
type
!=
"Mish"
)
break
;
Ptr
<
ActivationLayer
>
nextActivLayer
=
nextData
->
layerInstance
.
dynamicCast
<
ActivationLayer
>
();
if
(
nextActivLayer
.
empty
())
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录