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
8e7e24ac
Commit
8e7e24ac
authored
7 years ago
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9394 from dkurt:fix_halide_wrapper
parents
cc5da834
4e28c00e
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
op_halide.cpp
modules/dnn/src/op_halide.cpp
+12
-0
op_halide.hpp
modules/dnn/src/op_halide.hpp
+5
-0
No files found.
modules/dnn/src/op_halide.cpp
View file @
8e7e24ac
...
...
@@ -76,6 +76,7 @@ HalideBackendNode::HalideBackendNode(const Ptr<HalideBackendNode>& base,
HalideBackendWrapper
::
HalideBackendWrapper
(
int
targetId
,
const
cv
::
Mat
&
m
)
:
BackendWrapper
(
DNN_BACKEND_HALIDE
,
targetId
)
{
managesDevMemory
=
true
;
buffer
=
wrapToHalideBuffer
(
m
);
if
(
targetId
==
DNN_TARGET_CPU
)
{
...
...
@@ -95,6 +96,7 @@ HalideBackendWrapper::HalideBackendWrapper(const Ptr<BackendWrapper>& base,
const
MatShape
&
shape
)
:
BackendWrapper
(
DNN_BACKEND_HALIDE
,
base
->
targetId
)
{
managesDevMemory
=
false
;
int
w
,
h
,
c
,
n
;
getCanonicalSize
(
shape
,
&
w
,
&
h
,
&
c
,
&
n
);
Halide
::
Buffer
<
float
>
baseBuffer
=
halideBuffer
(
base
);
...
...
@@ -113,6 +115,16 @@ HalideBackendWrapper::HalideBackendWrapper(const Ptr<BackendWrapper>& base,
}
}
HalideBackendWrapper
::~
HalideBackendWrapper
()
{
if
(
buffer
.
has_device_allocation
()
&&
!
managesDevMemory
)
{
buffer
.
raw_buffer
()
->
device
=
0
;
buffer
.
raw_buffer
()
->
device_interface
=
0
;
buffer
.
set_device_dirty
(
false
);
}
}
void
HalideBackendWrapper
::
copyToHost
()
{
CV_Assert
(
targetId
==
DNN_TARGET_CPU
||
buffer
.
device_dirty
());
...
...
This diff is collapsed.
Click to expand it.
modules/dnn/src/op_halide.hpp
View file @
8e7e24ac
...
...
@@ -57,9 +57,14 @@ namespace dnn
HalideBackendWrapper
(
const
Ptr
<
BackendWrapper
>&
base
,
const
MatShape
&
shape
);
~
HalideBackendWrapper
();
virtual
void
copyToHost
();
Halide
::
Buffer
<
float
>
buffer
;
private
:
bool
managesDevMemory
;
};
#endif // HAVE_HALIDE
...
...
This diff is collapsed.
Click to expand it.
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