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
cbf4fdbb
Unverified
Commit
cbf4fdbb
authored
6 years ago
by
Tianqi Chen
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[RELAY] Fix compilation under clang-4.0 (#1998)
parent
44df04a1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/relay/ir/hash.cc
+13
-14
13 additions, 14 deletions
src/relay/ir/hash.cc
with
13 additions
and
14 deletions
src/relay/ir/hash.cc
+
13
−
14
View file @
cbf4fdbb
...
...
@@ -100,26 +100,24 @@ class RelayHashHandler:
using
AttrsHashHandler
::
VisitAttr_
;
size_t
VisitAttr_
(
const
Variable
*
var
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
Variable
::
_type_key
);
auto
it
=
hash_map_
.
find
(
GetRef
<
VarExpr
>
(
var
));
if
(
it
!=
hash_map_
.
end
())
{
return
it
->
second
;
}
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
var
->
_type_key
);
return
Combine
(
hash
,
std
::
hash
<
std
::
string
>
()(
var
->
name_hint
));
}
// Type hashing
size_t
VisitType_
(
const
TensorTypeNode
*
tensor_type
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
t
ensor
_t
ype
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
T
ensor
T
ype
Node
::
_type_key
);
hash
=
Combine
(
hash
,
DataTypeHash
(
tensor_type
->
dtype
));
hash
=
Combine
(
hash
,
Hash
(
tensor_type
->
shape
));
return
hash
;
}
size_t
VisitType_
(
const
IncompleteTypeNode
*
incomplete
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
i
ncomplete
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
I
ncomplete
TypeNode
::
_type_key
);
return
Combine
(
hash
,
std
::
hash
<
int
>
()(
incomplete
->
kind
));
}
...
...
@@ -139,7 +137,7 @@ class RelayHashHandler:
}
size_t
VisitType_
(
const
FuncTypeNode
*
func_type
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
f
unc
_t
ype
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
F
unc
T
ype
Node
::
_type_key
);
for
(
auto
type_param
:
func_type
->
type_params
)
{
hash
=
Combine
(
hash
,
BindVar
(
type_param
));
...
...
@@ -158,7 +156,7 @@ class RelayHashHandler:
}
size_t
VisitType_
(
const
TypeRelationNode
*
type_rel
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
t
ype
_rel
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
T
ype
RelationNode
::
_type_key
);
hash
=
Combine
(
hash
,
std
::
hash
<
std
::
string
>
()(
type_rel
->
func
->
name
));
hash
=
Combine
(
hash
,
AttrHash
(
type_rel
->
attrs
));
...
...
@@ -170,7 +168,7 @@ class RelayHashHandler:
}
size_t
VisitType_
(
const
TupleTypeNode
*
tuple_type
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
t
uple
_t
ype
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
T
uple
T
ype
Node
::
_type_key
);
for
(
size_t
i
=
0
;
i
<
tuple_type
->
fields
.
size
();
i
++
)
{
hash
=
Combine
(
hash
,
TypeHash
(
tuple_type
->
fields
[
i
]));
}
...
...
@@ -213,7 +211,7 @@ class RelayHashHandler:
}
size_t
VisitExpr_
(
const
TupleNode
*
tuple
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
t
uple
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
T
uple
Node
::
_type_key
);
for
(
size_t
i
=
0
;
i
<
tuple
->
fields
.
size
();
i
++
)
{
hash
=
Combine
(
hash
,
ExprHash
(
tuple
->
fields
[
i
]));
}
...
...
@@ -221,7 +219,7 @@ class RelayHashHandler:
}
size_t
VisitExpr_
(
const
FunctionNode
*
func
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
f
unc
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
F
unc
tionNode
::
_type_key
);
for
(
auto
type_param
:
func
->
type_params
)
{
hash
=
Combine
(
hash
,
BindVar
(
type_param
));
}
...
...
@@ -237,7 +235,7 @@ class RelayHashHandler:
}
size_t
VisitExpr_
(
const
CallNode
*
call
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
c
all
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
C
all
Node
::
_type_key
);
hash
=
Combine
(
hash
,
ExprHash
(
call
->
op
));
for
(
auto
arg
:
call
->
args
)
{
...
...
@@ -250,7 +248,7 @@ class RelayHashHandler:
}
size_t
VisitExpr_
(
const
LetNode
*
let
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
l
et
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
L
et
Node
::
_type_key
);
hash
=
Combine
(
hash
,
BindVar
(
let
->
var
));
hash
=
Combine
(
hash
,
ExprHash
(
let
->
value
));
hash
=
Combine
(
hash
,
ExprHash
(
let
->
body
));
...
...
@@ -258,7 +256,8 @@ class RelayHashHandler:
}
size_t
VisitExpr_
(
const
IfNode
*
ite
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
ite
->
_type_key
);
size_t
key
=
std
::
hash
<
std
::
string
>
()(
IfNode
::
_type_key
);
size_t
hash
=
key
;
hash
=
Combine
(
hash
,
ExprHash
(
ite
->
cond
));
hash
=
Combine
(
hash
,
ExprHash
(
ite
->
true_branch
));
hash
=
Combine
(
hash
,
ExprHash
(
ite
->
false_branch
));
...
...
@@ -274,7 +273,7 @@ class RelayHashHandler:
}
size_t
VisitExpr_
(
const
TupleGetItemNode
*
get_item
)
final
{
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
get_item
->
_type_key
);
size_t
hash
=
std
::
hash
<
std
::
string
>
()(
TupleGetItemNode
::
_type_key
);
hash
=
Combine
(
hash
,
ExprHash
(
get_item
->
tuple
));
hash
=
Combine
(
hash
,
std
::
hash
<
int
>
()(
get_item
->
index
));
return
hash
;
...
...
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