Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
d27c11e0
Commit
d27c11e0
authored
Sep 17, 2017
by
tqchen
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DLL] Use local dll, not de-allocate function in shutdown
parent
c6c42af0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
nnvm/python/nnvm/_base.py
+1
-1
nnvm/src/compiler/packed_func_ext.cc
+6
-4
No files found.
nnvm/python/nnvm/_base.py
View file @
d27c11e0
...
...
@@ -35,7 +35,7 @@ class NNVMError(Exception):
def
_load_lib
():
"""Load libary by searching possible path."""
lib_path
=
libinfo
.
find_lib_path
()
lib
=
ctypes
.
CDLL
(
lib_path
[
0
],
ctypes
.
RTLD_
GLOB
AL
)
lib
=
ctypes
.
CDLL
(
lib_path
[
0
],
ctypes
.
RTLD_
LOC
AL
)
# DMatrix functions
lib
.
NNGetLastError
.
restype
=
ctypes
.
c_char_p
return
lib
...
...
nnvm/src/compiler/packed_func_ext.cc
View file @
d27c11e0
...
...
@@ -71,11 +71,12 @@ GetAttrDict(const NodeAttrs& attrs) {
TVM_REGISTER_GLOBAL
(
"nnvm._register_compute"
)
.
set_body
([](
TVMArgs
args
,
TVMRetValue
*
rv
)
{
PackedFunc
f
=
args
[
1
];
// Intentionally copy and not de-allocate it, to avoid free pyobject during shutdown
PackedFunc
*
f
=
new
PackedFunc
(
args
[
1
].
operator
PackedFunc
());
Op
&
op
=
::
dmlc
::
Registry
<
nnvm
::
Op
>::
Get
()
->
__REGISTER_OR_GET__
(
args
[
0
]);
auto
fcompute
=
[
f
](
const
NodeAttrs
&
attrs
,
const
Array
<
Tensor
>&
inputs
)
->
Array
<
Tensor
>
{
TVMRetValue
ret
=
f
(
GetAttrDict
(
attrs
),
inputs
);
TVMRetValue
ret
=
(
*
f
)
(
GetAttrDict
(
attrs
),
inputs
);
if
((
*
ret
.
ptr
<
std
::
shared_ptr
<
tvm
::
Node
>
>
())
->
derived_from
<
tvm
::
TensorNode
>
())
{
return
{
ret
.
operator
Tensor
()};
}
else
{
...
...
@@ -87,12 +88,13 @@ TVM_REGISTER_GLOBAL("nnvm._register_compute")
TVM_REGISTER_GLOBAL
(
"nnvm._register_schedule"
)
.
set_body
([](
TVMArgs
args
,
TVMRetValue
*
rv
)
{
PackedFunc
f
=
args
[
1
];
// Intentionally copy and not de-allocate it, to avoid free pyobject during shutdown
PackedFunc
*
f
=
new
PackedFunc
(
args
[
1
].
operator
PackedFunc
());
Op
&
op
=
::
dmlc
::
Registry
<
nnvm
::
Op
>::
Get
()
->
__REGISTER_OR_GET__
(
args
[
0
]);
auto
fschedule
=
[
f
](
const
NodeAttrs
&
attrs
,
const
Array
<
Tensor
>&
outs
,
const
std
::
string
&
target
)
{
return
f
(
GetAttrDict
(
attrs
),
outs
,
target
).
operator
Schedule
();
return
(
*
f
)
(
GetAttrDict
(
attrs
),
outs
,
target
).
operator
Schedule
();
};
op
.
set_attr
<
FTVMSchedule
>
(
"FTVMSchedule"
,
fschedule
,
args
[
2
]);
});
...
...
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