Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
4e8cd462
Commit
4e8cd462
authored
Mar 23, 2020
by
YashasSamaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix CUDNN_STATUS_NOT_SUPPORTED, remove redundant fusion checks
parent
4dfa798e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
15 deletions
+29
-15
cudnn.hpp
modules/dnn/src/cuda4dnn/csl/cudnn/cudnn.hpp
+10
-2
convolution.hpp
modules/dnn/src/cuda4dnn/primitives/convolution.hpp
+19
-3
dnn.cpp
modules/dnn/src/dnn.cpp
+0
-10
No files found.
modules/dnn/src/cuda4dnn/csl/cudnn/cudnn.hpp
View file @
4e8cd462
...
...
@@ -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
View file @
4e8cd462
...
...
@@ -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
;
}
}
else
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
View file @
4e8cd462
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment