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
19f8c123
Commit
19f8c123
authored
Sep 06, 2019
by
雾雨魔理沙
Committed by
Haichen Shen
Sep 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Relay][Op] Make Type Relation catch more errors (#3899)
* save * init * move type_relations
parent
ca0292d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
src/relay/op/op_common.h
+1
-0
src/relay/op/tensor/transform.cc
+6
-7
No files found.
src/relay/op/op_common.h
View file @
19f8c123
...
...
@@ -30,6 +30,7 @@
#include <tvm/relay/op.h>
#include <tvm/relay/op_attr_types.h>
#include <vector>
#include "type_relations.h"
#include "../pass/alter_op_layout.h"
namespace
tvm
{
...
...
src/relay/op/tensor/transform.cc
View file @
19f8c123
...
...
@@ -18,7 +18,7 @@
*/
/*!
* Copyright (c) 201
8
by Contributors
* Copyright (c) 201
9
by Contributors
* \file transform.cc
* \brief Transform operators.
*/
...
...
@@ -1541,7 +1541,6 @@ RELAY_REGISTER_OP("squeeze")
.
set_attr
<
TOpPattern
>
(
"TOpPattern"
,
kInjective
);
// Have no idea how to assert the constraint.
// CollapseSumLike: <A, B> -> B where BroadCast(A, B) = A
bool
CollapseSumLikeRel
(
const
Array
<
Type
>&
types
,
int
num_inputs
,
...
...
@@ -1549,7 +1548,7 @@ bool CollapseSumLikeRel(const Array<Type>& types,
const
TypeReporter
&
reporter
)
{
CHECK_EQ
(
types
.
size
(),
3
);
reporter
->
Assign
(
types
[
2
],
types
[
1
]);
return
true
;
return
BroadcastRel
({
types
[
0
],
types
[
1
],
types
[
0
]},
2
,
Attrs
(),
reporter
)
;
}
Expr
MakeCollapseSumLike
(
Expr
data
,
...
...
@@ -1593,7 +1592,7 @@ bool BroadCastToRel(const Array<Type>& types,
if
(
intt
==
nullptr
)
{
return
false
;
}
auto
type
=
TensorTypeNode
::
make
(
ioattrs
->
shape
,
intt
->
dtype
);
reporter
->
Assign
(
types
[
1
],
type
);
return
true
;
return
BroadcastRel
({
types
[
0
],
types
[
1
],
types
[
1
]},
2
,
Attrs
(),
reporter
)
;
}
Expr
MakeBroadCastTo
(
Expr
data
,
Array
<
IndexExpr
>
shape
)
{
...
...
@@ -1632,7 +1631,7 @@ bool BroadCastToLikeRel(const Array<Type>& types,
const
TypeReporter
&
reporter
)
{
CHECK_EQ
(
types
.
size
(),
3
);
reporter
->
Assign
(
types
[
2
],
types
[
1
]);
return
true
;
return
BroadcastRel
({
types
[
0
],
types
[
1
],
types
[
1
]},
2
,
Attrs
(),
reporter
)
;
}
Expr
MakeBroadCastToLike
(
Expr
data
,
...
...
@@ -2493,9 +2492,9 @@ RELAY_REGISTER_OP("one_hot")
**off_value** Value to fill at all other positions besides indices.
**depth** Depth of the one-hot dimension.
**axis** Axis to fill.
**dtype**)code"
TVM_ADD_FILELINE
)
.
set_attrs_type_key
(
"relay.attrs.OneHotAttrs"
)
.
set_num_inputs
(
3
)
...
...
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