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
60fb4cc3
Commit
60fb4cc3
authored
Aug 16, 2018
by
Paul
Browse files
Preallocate vector
parent
b28bd72d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
test/op_shape_test.cpp
test/op_shape_test.cpp
+8
-6
No files found.
test/op_shape_test.cpp
View file @
60fb4cc3
...
@@ -10,9 +10,10 @@ void expect_shape(migraph::shape expected, migraph::operation op, Ts... xs)
...
@@ -10,9 +10,10 @@ void expect_shape(migraph::shape expected, migraph::operation op, Ts... xs)
{
{
migraph
::
program
p
;
migraph
::
program
p
;
std
::
vector
<
migraph
::
shape
>
shapes
{
xs
...};
std
::
vector
<
migraph
::
shape
>
shapes
{
xs
...};
std
::
vector
<
migraph
::
instruction_ref
>
args
;
std
::
vector
<
migraph
::
instruction_ref
>
args
(
shapes
.
size
());
for
(
auto
&&
s
:
shapes
)
std
::
transform
(
shapes
.
begin
(),
shapes
.
end
(),
args
.
begin
(),
[
&
](
auto
&&
s
)
{
args
.
push_back
(
p
.
add_outline
(
s
));
return
p
.
add_outline
(
s
);
});
p
.
add_instruction
(
op
,
args
);
p
.
add_instruction
(
op
,
args
);
if
(
p
.
get_shape
()
!=
expected
)
if
(
p
.
get_shape
()
!=
expected
)
{
{
...
@@ -28,9 +29,10 @@ void throws_shape(migraph::operation op, Ts... xs)
...
@@ -28,9 +29,10 @@ void throws_shape(migraph::operation op, Ts... xs)
{
{
migraph
::
program
p
;
migraph
::
program
p
;
std
::
vector
<
migraph
::
shape
>
shapes
{
xs
...};
std
::
vector
<
migraph
::
shape
>
shapes
{
xs
...};
std
::
vector
<
migraph
::
instruction_ref
>
args
;
std
::
vector
<
migraph
::
instruction_ref
>
args
(
shapes
.
size
());
for
(
auto
&&
s
:
shapes
)
std
::
transform
(
shapes
.
begin
(),
shapes
.
end
(),
args
.
begin
(),
[
&
](
auto
&&
s
)
{
args
.
push_back
(
p
.
add_outline
(
s
));
return
p
.
add_outline
(
s
);
});
bool
thrown
=
test
::
throws
([
&
]
{
p
.
add_instruction
(
op
,
args
);
});
bool
thrown
=
test
::
throws
([
&
]
{
p
.
add_instruction
(
op
,
args
);
});
if
(
not
thrown
)
if
(
not
thrown
)
{
{
...
...
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