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
8a4f5778
Commit
8a4f5778
authored
Feb 20, 2019
by
Khalique
Browse files
formatting
parent
461a68cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
src/tf/tf.cpp
src/tf/tf.cpp
+7
-7
test/tf/tf_test.cpp
test/tf/tf_test.cpp
+3
-2
No files found.
src/tf/tf.cpp
View file @
8a4f5778
...
@@ -43,7 +43,7 @@ struct tf_parser
...
@@ -43,7 +43,7 @@ struct tf_parser
copy
(
attrs
.
begin
(),
attrs
.
end
(),
std
::
back_inserter
(
axes
));
copy
(
attrs
.
begin
(),
attrs
.
end
(),
std
::
back_inserter
(
axes
));
if
(
is_nhwc
)
if
(
is_nhwc
)
{
{
for
(
size_t
&
axis
:
axes
)
for
(
size_t
&
axis
:
axes
)
{
{
parse_axis
(
axis
);
parse_axis
(
axis
);
}
}
...
@@ -236,15 +236,15 @@ struct tf_parser
...
@@ -236,15 +236,15 @@ struct tf_parser
attribute_map
attributes
,
attribute_map
attributes
,
const
std
::
vector
<
instruction_ref
>&
)
const
std
::
vector
<
instruction_ref
>&
)
{
{
literal
v
=
parse_tensor
(
attributes
.
at
(
"value"
).
tensor
());
literal
v
=
parse_tensor
(
attributes
.
at
(
"value"
).
tensor
());
auto
l0
=
prog
.
add_literal
(
v
);
auto
l0
=
prog
.
add_literal
(
v
);
size_t
num_axes
=
l0
->
get_shape
().
lens
().
size
();
size_t
num_axes
=
l0
->
get_shape
().
lens
().
size
();
if
(
num_axes
>=
4
)
if
(
num_axes
>=
4
)
{
{
std
::
vector
<
int64_t
>
transpose_axes
=
get_axes
(
num_axes
);
std
::
vector
<
int64_t
>
transpose_axes
=
get_axes
(
num_axes
);
reorder_data
(
transpose_axes
);
reorder_data
(
transpose_axes
);
l0
=
prog
.
add_instruction
(
op
::
transpose
{
transpose_axes
},
l0
);
l0
=
prog
.
add_instruction
(
op
::
transpose
{
transpose_axes
},
l0
);
}
}
return
l0
;
return
l0
;
}
}
...
@@ -306,7 +306,7 @@ struct tf_parser
...
@@ -306,7 +306,7 @@ struct tf_parser
{
{
l0
=
prog
.
add_instruction
(
op
::
transpose
{{
1
,
3
,
0
,
2
}},
args
[
1
]);
l0
=
prog
.
add_instruction
(
op
::
transpose
{{
1
,
3
,
0
,
2
}},
args
[
1
]);
}
}
else
if
(
l0
->
name
()
!=
"@param"
)
else
if
(
l0
->
name
()
!=
"@param"
)
MIGRAPHX_THROW
(
"cannot infer data format for weights"
);
MIGRAPHX_THROW
(
"cannot infer data format for weights"
);
return
prog
.
add_instruction
(
op
,
{
args
[
0
],
l0
});
return
prog
.
add_instruction
(
op
,
{
args
[
0
],
l0
});
...
@@ -424,8 +424,8 @@ struct tf_parser
...
@@ -424,8 +424,8 @@ struct tf_parser
{
{
reorder_data
(
dims
);
reorder_data
(
dims
);
}
}
shape
s
=
shape
{
shape_type
,
dims
};
shape
s
=
shape
{
shape_type
,
dims
};
instructions
[
name
]
=
prog
.
add_parameter
(
name
,
s
);
instructions
[
name
]
=
prog
.
add_parameter
(
name
,
s
);
}
}
for
(
auto
&&
p
:
nodes
)
for
(
auto
&&
p
:
nodes
)
{
{
...
...
test/tf/tf_test.cpp
View file @
8a4f5778
...
@@ -101,9 +101,10 @@ TEST_CASE(conv_test)
...
@@ -101,9 +101,10 @@ TEST_CASE(conv_test)
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
16
,
16
}});
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
16
,
16
}});
std
::
vector
<
float
>
weight_data
(
3
*
3
*
3
*
32
);
std
::
vector
<
float
>
weight_data
(
3
*
3
*
3
*
32
);
std
::
fill
(
weight_data
.
begin
(),
weight_data
.
end
(),
1.0
f
);
std
::
fill
(
weight_data
.
begin
(),
weight_data
.
end
(),
1.0
f
);
auto
l1
=
p
.
add_literal
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
3
,
3
,
32
}},
weight_data
);
auto
l1
=
p
.
add_literal
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
3
,
3
,
32
}},
weight_data
);
migraphx
::
op
::
convolution
op
;
migraphx
::
op
::
convolution
op
;
op
.
padding_mode
=
migraphx
::
op
::
padding_mode_t
::
same
;
op
.
padding_mode
=
migraphx
::
op
::
padding_mode_t
::
same
;
...
...
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