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
1e4bb2f8
Commit
1e4bb2f8
authored
Apr 27, 2018
by
Yizhi Liu
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow missing FCorrectLayout (#457)
* allow missing FCorrectLayout * misunderstood OpMap[], fix
parent
1b5877f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
nnvm/src/pass/correct_layout.cc
+8
-9
No files found.
nnvm/src/pass/correct_layout.cc
View file @
1e4bb2f8
...
...
@@ -28,11 +28,11 @@ nnvm::NodePtr CreateLayoutTransformNode(const Layout& src,
using
LayoutAttrDict
=
std
::
unordered_map
<
const
Node
*
,
std
::
vector
<
Layout
>
>
;
/*!
* \brief A simple layout infer pass that will
* \brief A simple layout infer
& correct
pass that will
* insert layout transform nodes automatically.
*/
nnvm
::
Graph
CorrectLayout
(
nnvm
::
Graph
src
)
{
static
auto
&
op_
infer
_layout
=
static
auto
&
op_
correct
_layout
=
nnvm
::
Op
::
GetAttr
<
FCorrectLayout
>
(
"FCorrectLayout"
);
const
IndexedGraph
&
idx
=
src
.
indexed_graph
();
...
...
@@ -91,14 +91,13 @@ nnvm::Graph CorrectLayout(nnvm::Graph src) {
}
}
const
auto
&
flayout
=
op_infer_layout
[
new_node
->
op
()];
CHECK
(
flayout
!=
nullptr
)
<<
"Attribute FCorrectLayout"
<<
" is not registered by op "
<<
inode
.
source
->
op
()
->
name
<<
" we are not able to complete layout transform."
;
CHECK
(
flayout
(
new_node
->
attrs
,
&
request_ilayouts
,
&
last_request_ilayouts
,
&
produce_olayouts
))
if
(
op_correct_layout
.
count
(
new_node
->
op
()))
{
const
auto
&
flayout
=
op_correct_layout
[
new_node
->
op
()];
CHECK
(
flayout
(
new_node
->
attrs
,
&
request_ilayouts
,
&
last_request_ilayouts
,
&
produce_olayouts
))
<<
"Layout infer fail"
;
CHECK_EQ
(
request_ilayouts
.
size
(),
num_inputs
);
CHECK_EQ
(
produce_olayouts
.
size
(),
num_outputs
);
CHECK_EQ
(
request_ilayouts
.
size
(),
num_inputs
);
CHECK_EQ
(
produce_olayouts
.
size
(),
num_outputs
);
}
// update new layouts
new_layouts
[
new_node
.
get
()]
=
std
::
move
(
produce_olayouts
);
...
...
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