Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
d27c11e0
Commit
d27c11e0
authored
7 years ago
by
tqchen
Committed by
Tianqi Chen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[DLL] Use local dll, not de-allocate function in shutdown
parent
c6c42af0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nnvm/python/nnvm/_base.py
+1
-1
1 addition, 1 deletion
nnvm/python/nnvm/_base.py
nnvm/src/compiler/packed_func_ext.cc
+6
-4
6 additions, 4 deletions
nnvm/src/compiler/packed_func_ext.cc
with
7 additions
and
5 deletions
nnvm/python/nnvm/_base.py
+
1
−
1
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_
G
LO
B
AL
)
lib
=
ctypes
.
CDLL
(
lib_path
[
0
],
ctypes
.
RTLD_LO
C
AL
)
# DMatrix functions
lib
.
NNGetLastError
.
restype
=
ctypes
.
c_char_p
return
lib
...
...
This diff is collapsed.
Click to expand it.
nnvm/src/compiler/packed_func_ext.cc
+
6
−
4
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
]);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment