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
88f53aa9
Commit
88f53aa9
authored
May 24, 2019
by
Paul
Browse files
Formatting
parent
4506cb47
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
src/tf/tf.cpp
src/tf/tf.cpp
+2
-1
test/tf/tf_test.cpp
test/tf/tf_test.cpp
+9
-6
No files found.
src/tf/tf.cpp
View file @
88f53aa9
...
...
@@ -409,7 +409,8 @@ struct tf_parser
new_weights_shape
[
0
]
=
out_channels
;
new_weights_shape
[
1
]
=
1
;
// Make sure weights are contiguous before doing reshape
auto
new_weights
=
prog
.
add_instruction
(
op
::
reshape
{
new_weights_shape
},
make_contiguous
(
weights
));
auto
new_weights
=
prog
.
add_instruction
(
op
::
reshape
{
new_weights_shape
},
make_contiguous
(
weights
));
return
prog
.
add_instruction
(
op
,
{
args
[
0
],
new_weights
});
}
...
...
test/tf/tf_test.cpp
View file @
88f53aa9
...
...
@@ -14,8 +14,11 @@
migraphx
::
program
optimize_tf
(
const
std
::
string
&
name
,
bool
is_nhwc
)
{
auto
prog
=
migraphx
::
parse_tf
(
name
,
is_nhwc
);
if
(
is_nhwc
)
migraphx
::
run_passes
(
prog
,
{
migraphx
::
simplify_reshapes
{},
migraphx
::
dead_code_elimination
{},
migraphx
::
eliminate_identity
{}});
if
(
is_nhwc
)
migraphx
::
run_passes
(
prog
,
{
migraphx
::
simplify_reshapes
{},
migraphx
::
dead_code_elimination
{},
migraphx
::
eliminate_identity
{}});
return
prog
;
}
...
...
@@ -189,7 +192,7 @@ TEST_CASE(mean_test)
migraphx
::
op
::
pooling
op
;
op
.
lengths
=
{
16
,
16
};
p
.
add_instruction
(
op
,
l0
);
auto
l3
=
p
.
add_instruction
(
op
,
l0
);
auto
l3
=
p
.
add_instruction
(
op
,
l0
);
p
.
add_instruction
(
migraphx
::
op
::
squeeze
{{
2
,
3
}},
l3
);
auto
prog
=
optimize_tf
(
"mean_test.pb"
,
false
);
...
...
@@ -247,11 +250,11 @@ TEST_CASE(pack_test)
TEST_CASE
(
pack_test_nhwc
)
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
1
,
1
}});
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
1
,
1
}});
auto
lt0
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
2
,
3
,
1
}},
l0
);
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
1
,
1
}});
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
1
,
1
}});
auto
lt1
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
2
,
3
,
1
}},
l1
);
auto
l2
=
p
.
add_parameter
(
"2"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
1
,
1
}});
auto
l2
=
p
.
add_parameter
(
"2"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
1
,
1
}});
auto
lt2
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
2
,
3
,
1
}},
l2
);
std
::
vector
<
migraphx
::
instruction_ref
>
args
{
lt0
,
lt1
,
lt2
};
std
::
vector
<
migraphx
::
instruction_ref
>
unsqueezed_args
;
...
...
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