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
b8e02348
Commit
b8e02348
authored
Jun 26, 2017
by
ziheng
Committed by
Tianqi Chen
Jun 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix] Avoid Directly Pass Python Context Object (#201)
parent
3cad2478
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
examples/graph_executor/python/tvm_graph/build.py
+1
-1
examples/graph_executor/src/graph_executor.cc
+3
-1
No files found.
examples/graph_executor/python/tvm_graph/build.py
View file @
b8e02348
...
@@ -29,7 +29,7 @@ def build(sym, target, shape, dtype="float32"):
...
@@ -29,7 +29,7 @@ def build(sym, target, shape, dtype="float32"):
def
bind
(
g
,
ctx
):
def
bind
(
g
,
ctx
):
m
=
_create_exec
(
g
.
handle
,
ctx
)
m
=
_create_exec
(
g
.
handle
,
ctx
.
device_type
,
ctx
.
device_id
)
return
m
return
m
...
...
examples/graph_executor/src/graph_executor.cc
View file @
b8e02348
...
@@ -263,7 +263,9 @@ tvm::runtime::Module CreateExecutor(nnvm::Graph g, TVMContext ctx) {
...
@@ -263,7 +263,9 @@ tvm::runtime::Module CreateExecutor(nnvm::Graph g, TVMContext ctx) {
TVM_REGISTER_GLOBAL
(
"tvm_graph._create_executor"
)
TVM_REGISTER_GLOBAL
(
"tvm_graph._create_executor"
)
.
set_body
([](
TVMArgs
args
,
TVMRetValue
*
rv
)
{
.
set_body
([](
TVMArgs
args
,
TVMRetValue
*
rv
)
{
void
*
graph_handle
=
args
[
0
];
void
*
graph_handle
=
args
[
0
];
TVMContext
ctx
=
args
[
1
];
int
device_type
=
args
[
1
];
int
device_id
=
args
[
2
];
TVMContext
ctx
{
static_cast
<
DLDeviceType
>
(
device_type
),
device_id
};
nnvm
::
Graph
g
=
static_cast
<
nnvm
::
Graph
*>
(
graph_handle
)[
0
];
nnvm
::
Graph
g
=
static_cast
<
nnvm
::
Graph
*>
(
graph_handle
)[
0
];
*
rv
=
CreateExecutor
(
g
,
ctx
);
*
rv
=
CreateExecutor
(
g
,
ctx
);
});
});
...
...
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