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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
src/relay/op/op_common.h
+1
-0
src/relay/op/tensor/transform.cc
+4
-5
No files found.
src/relay/op/op_common.h
View file @
19f8c123
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include <tvm/relay/op.h>
#include <tvm/relay/op.h>
#include <tvm/relay/op_attr_types.h>
#include <tvm/relay/op_attr_types.h>
#include <vector>
#include <vector>
#include "type_relations.h"
#include "../pass/alter_op_layout.h"
#include "../pass/alter_op_layout.h"
namespace
tvm
{
namespace
tvm
{
...
...
src/relay/op/tensor/transform.cc
View file @
19f8c123
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
*/
*/
/*!
/*!
* Copyright (c) 201
8
by Contributors
* Copyright (c) 201
9
by Contributors
* \file transform.cc
* \file transform.cc
* \brief Transform operators.
* \brief Transform operators.
*/
*/
...
@@ -1541,7 +1541,6 @@ RELAY_REGISTER_OP("squeeze")
...
@@ -1541,7 +1541,6 @@ RELAY_REGISTER_OP("squeeze")
.
set_attr
<
TOpPattern
>
(
"TOpPattern"
,
kInjective
);
.
set_attr
<
TOpPattern
>
(
"TOpPattern"
,
kInjective
);
// Have no idea how to assert the constraint.
// CollapseSumLike: <A, B> -> B where BroadCast(A, B) = A
// CollapseSumLike: <A, B> -> B where BroadCast(A, B) = A
bool
CollapseSumLikeRel
(
const
Array
<
Type
>&
types
,
bool
CollapseSumLikeRel
(
const
Array
<
Type
>&
types
,
int
num_inputs
,
int
num_inputs
,
...
@@ -1549,7 +1548,7 @@ bool CollapseSumLikeRel(const Array<Type>& types,
...
@@ -1549,7 +1548,7 @@ bool CollapseSumLikeRel(const Array<Type>& types,
const
TypeReporter
&
reporter
)
{
const
TypeReporter
&
reporter
)
{
CHECK_EQ
(
types
.
size
(),
3
);
CHECK_EQ
(
types
.
size
(),
3
);
reporter
->
Assign
(
types
[
2
],
types
[
1
]);
reporter
->
Assign
(
types
[
2
],
types
[
1
]);
return
true
;
return
BroadcastRel
({
types
[
0
],
types
[
1
],
types
[
0
]},
2
,
Attrs
(),
reporter
)
;
}
}
Expr
MakeCollapseSumLike
(
Expr
data
,
Expr
MakeCollapseSumLike
(
Expr
data
,
...
@@ -1593,7 +1592,7 @@ bool BroadCastToRel(const Array<Type>& types,
...
@@ -1593,7 +1592,7 @@ bool BroadCastToRel(const Array<Type>& types,
if
(
intt
==
nullptr
)
{
return
false
;
}
if
(
intt
==
nullptr
)
{
return
false
;
}
auto
type
=
TensorTypeNode
::
make
(
ioattrs
->
shape
,
intt
->
dtype
);
auto
type
=
TensorTypeNode
::
make
(
ioattrs
->
shape
,
intt
->
dtype
);
reporter
->
Assign
(
types
[
1
],
type
);
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
)
{
Expr
MakeBroadCastTo
(
Expr
data
,
Array
<
IndexExpr
>
shape
)
{
...
@@ -1632,7 +1631,7 @@ bool BroadCastToLikeRel(const Array<Type>& types,
...
@@ -1632,7 +1631,7 @@ bool BroadCastToLikeRel(const Array<Type>& types,
const
TypeReporter
&
reporter
)
{
const
TypeReporter
&
reporter
)
{
CHECK_EQ
(
types
.
size
(),
3
);
CHECK_EQ
(
types
.
size
(),
3
);
reporter
->
Assign
(
types
[
2
],
types
[
1
]);
reporter
->
Assign
(
types
[
2
],
types
[
1
]);
return
true
;
return
BroadcastRel
({
types
[
0
],
types
[
1
],
types
[
1
]},
2
,
Attrs
(),
reporter
)
;
}
}
Expr
MakeBroadCastToLike
(
Expr
data
,
Expr
MakeBroadCastToLike
(
Expr
data
,
...
...
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