Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
dd465fab
Commit
dd465fab
authored
Jul 10, 2018
by
Paul
Browse files
Formatting
parent
203a4c4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
src/include/migraph/instruction.hpp
src/include/migraph/instruction.hpp
+11
-5
No files found.
src/include/migraph/instruction.hpp
View file @
dd465fab
...
@@ -65,15 +65,20 @@ struct instruction
...
@@ -65,15 +65,20 @@ struct instruction
bool
valid
(
instruction_ref
start
)
const
bool
valid
(
instruction_ref
start
)
const
{
{
std
::
vector
<
shape
>
shapes
(
arguments
.
size
());
std
::
vector
<
shape
>
shapes
(
arguments
.
size
());
std
::
transform
(
arguments
.
begin
(),
arguments
.
end
(),
shapes
.
begin
(),
[](
instruction_ref
ins
)
{
return
ins
->
result
;
});
std
::
transform
(
arguments
.
begin
(),
arguments
.
end
(),
shapes
.
begin
(),
[](
instruction_ref
ins
)
{
return
ins
->
result
;
});
shape
computed
;
shape
computed
;
try
try
{
{
computed
=
op
.
compute_shape
(
shapes
);
computed
=
op
.
compute_shape
(
shapes
);
}
}
catch
(
migraph
::
exception
&
)
{
return
false
;
}
catch
(
migraph
::
exception
&
)
{
return
false
;
}
return
result
==
computed
&&
return
result
==
computed
&&
std
::
all_of
(
output
.
begin
(),
std
::
all_of
(
output
.
begin
(),
output
.
end
(),
output
.
end
(),
[
&
](
instruction_ref
i
)
{
[
&
](
instruction_ref
i
)
{
return
std
::
find
(
i
->
arguments
.
begin
(),
i
->
arguments
.
end
(),
*
this
)
!=
return
std
::
find
(
i
->
arguments
.
begin
(),
i
->
arguments
.
end
(),
*
this
)
!=
...
@@ -81,7 +86,8 @@ struct instruction
...
@@ -81,7 +86,8 @@ struct instruction
})
&&
})
&&
std
::
all_of
(
arguments
.
begin
(),
arguments
.
end
(),
[
&
](
instruction_ref
i
)
{
std
::
all_of
(
arguments
.
begin
(),
arguments
.
end
(),
[
&
](
instruction_ref
i
)
{
auto
self
=
std
::
find
(
i
->
output
.
begin
(),
i
->
output
.
end
(),
*
this
);
auto
self
=
std
::
find
(
i
->
output
.
begin
(),
i
->
output
.
end
(),
*
this
);
return
self
!=
i
->
output
.
end
()
&&
std
::
distance
(
start
,
i
)
<
std
::
distance
(
start
,
*
self
);
return
self
!=
i
->
output
.
end
()
&&
std
::
distance
(
start
,
i
)
<
std
::
distance
(
start
,
*
self
);
});
});
}
}
...
...
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