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
1b2e5ced
Commit
1b2e5ced
authored
7 years ago
by
Tianqi Chen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[RUNTIME] Remove parameter def from runtime (#486)
parent
b18143e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dmlc-core
+1
-1
1 addition, 1 deletion
dmlc-core
src/runtime/graph/graph_runtime.cc
+34
-3
34 additions, 3 deletions
src/runtime/graph/graph_runtime.cc
src/runtime/graph/graph_runtime.h
+1
-9
1 addition, 9 deletions
src/runtime/graph/graph_runtime.h
with
36 additions
and
13 deletions
dmlc-core
@
04f91953
Compare
a384fb9e
...
04f91953
Subproject commit
a384fb9ed09d0c430c468db91abb3694deb88e54
Subproject commit
04f91953ace74aced3bb317990515304c5425849
This diff is collapsed.
Click to expand it.
src/runtime/graph/graph_runtime.cc
+
34
−
3
View file @
1b2e5ced
...
...
@@ -156,6 +156,37 @@ class GraphRuntime : public ModuleNode {
// control deps
std
::
vector
<
uint32_t
>
control_deps
;
// JSON Loader
void
LoadAttrs
(
dmlc
::
JSONReader
*
reader
,
TVMOpParam
*
param
)
{
int
bitmask
=
0
;
std
::
string
key
,
value
;
reader
->
BeginObject
();
while
(
reader
->
NextObjectItem
(
&
key
))
{
if
(
key
==
"func_name"
)
{
reader
->
Read
(
&
value
);
param
->
func_name
=
value
;
bitmask
|=
1
;
}
else
if
(
key
==
"num_inputs"
)
{
reader
->
Read
(
&
value
);
std
::
istringstream
is
(
value
);
is
>>
param
->
num_inputs
;
bitmask
|=
2
;
}
else
if
(
key
==
"num_outputs"
)
{
reader
->
Read
(
&
value
);
std
::
istringstream
is
(
value
);
is
>>
param
->
num_outputs
;
bitmask
|=
4
;
}
else
if
(
key
==
"flatten_data"
)
{
reader
->
Read
(
&
value
);
std
::
istringstream
is
(
value
);
is
>>
param
->
flatten_data
;
bitmask
|=
8
;
}
else
{
reader
->
Read
(
&
value
);
}
}
CHECK_EQ
(
bitmask
,
1
|
2
|
4
|
8
)
<<
"invalid format"
;
}
// JSON Loader
void
Load
(
dmlc
::
JSONReader
*
reader
)
{
reader
->
BeginObject
();
std
::
unordered_map
<
std
::
string
,
std
::
string
>
dict
;
...
...
@@ -172,8 +203,7 @@ class GraphRuntime : public ModuleNode {
reader
->
Read
(
&
inputs
);
bitmask
|=
4
;
}
else
if
(
key
==
"attr"
||
key
==
"attrs"
)
{
reader
->
Read
(
&
dict
);
param
.
Init
(
dict
);
this
->
LoadAttrs
(
reader
,
&
param
);
}
else
if
(
key
==
"control_deps"
)
{
reader
->
Read
(
&
control_deps
);
}
else
{
...
...
@@ -263,6 +293,8 @@ class GraphRuntime : public ModuleNode {
}
else
if
(
key
==
"attrs"
)
{
reader
->
Read
(
&
attrs_
);
bitmask
|=
16
;
}
else
{
LOG
(
FATAL
)
<<
"key "
<<
key
<<
" is not supported"
;
}
}
CHECK_EQ
(
bitmask
,
1
|
2
|
4
|
8
|
16
)
<<
"invalid format"
;
...
...
@@ -320,7 +352,6 @@ class GraphRuntime : public ModuleNode {
std
::
vector
<
std
::
function
<
void
()
>
>
op_execs_
;
};
DMLC_REGISTER_PARAMETER
(
TVMOpParam
);
bool
GraphRuntime
::
LoadDLTensor
(
dmlc
::
Stream
*
strm
,
DLTensor
*
tensor
)
{
uint64_t
header
,
reserved
;
...
...
This diff is collapsed.
Click to expand it.
src/runtime/graph/graph_runtime.h
+
1
−
9
View file @
1b2e5ced
...
...
@@ -8,7 +8,6 @@
#ifndef TVM_RUNTIME_GRAPH_GRAPH_RUNTIME_H_
#define TVM_RUNTIME_GRAPH_GRAPH_RUNTIME_H_
#include
<dmlc/parameter.h>
#include
<string>
namespace
tvm
{
...
...
@@ -20,18 +19,11 @@ constexpr uint64_t kTVMNDArrayMagic = 0xDD5E40F096B4A13F;
constexpr
uint64_t
kTVMNDArrayListMagic
=
0xF7E58D4F05049CB7
;
/*! \brief operator attributes about tvm op */
struct
TVMOpParam
:
public
dmlc
::
Parameter
<
TVMOpParam
>
{
struct
TVMOpParam
{
std
::
string
func_name
;
uint32_t
num_inputs
;
uint32_t
num_outputs
;
uint32_t
flatten_data
;
DMLC_DECLARE_PARAMETER
(
TVMOpParam
)
{
DMLC_DECLARE_FIELD
(
func_name
);
DMLC_DECLARE_FIELD
(
num_inputs
).
set_default
(
1
);
DMLC_DECLARE_FIELD
(
num_outputs
).
set_default
(
1
);
DMLC_DECLARE_FIELD
(
flatten_data
).
set_default
(
0
);
}
};
}
// namespace runtime
...
...
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