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
fa983162
Commit
fa983162
authored
Feb 28, 2019
by
Khalique
Browse files
formatting
parent
ee39cf0c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
src/tf/tf.cpp
src/tf/tf.cpp
+18
-18
No files found.
src/tf/tf.cpp
View file @
fa983162
...
@@ -56,9 +56,10 @@ struct tf_parser
...
@@ -56,9 +56,10 @@ struct tf_parser
std
::
vector
<
T
>
new_axes
;
std
::
vector
<
T
>
new_axes
;
if
(
is_nhwc
)
if
(
is_nhwc
)
{
{
std
::
transform
(
axes
.
begin
(),
axes
.
end
(),
std
::
back_inserter
(
new_axes
),
[
&
](
size_t
axis
)
{
std
::
transform
(
axes
.
begin
(),
return
parse_axis
(
axis
);
axes
.
end
(),
});
std
::
back_inserter
(
new_axes
),
[
&
](
size_t
axis
)
{
return
parse_axis
(
axis
);
});
}
}
return
new_axes
;
return
new_axes
;
}
}
...
@@ -334,14 +335,13 @@ struct tf_parser
...
@@ -334,14 +335,13 @@ struct tf_parser
return
prog
.
add_instruction
(
op
,
{
args
[
0
],
weights
});
return
prog
.
add_instruction
(
op
,
{
args
[
0
],
weights
});
}
}
instruction_ref
parse_mean
(
const
std
::
string
&
,
instruction_ref
attribute_map
attributes
,
parse_mean
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
std
::
vector
<
instruction_ref
>
args
)
{
{
auto
axes
=
parse_axes
(
args
[
1
]
->
eval
().
get
<
int32_t
>
().
to_vector
());
auto
axes
=
parse_axes
(
args
[
1
]
->
eval
().
get
<
int32_t
>
().
to_vector
());
bool
keep_dims
=
attributes
.
at
(
"keep_dims"
).
b
();
bool
keep_dims
=
attributes
.
at
(
"keep_dims"
).
b
();
std
::
vector
<
int32_t
>
hw_axes
{
2
,
3
};
std
::
vector
<
int32_t
>
hw_axes
{
2
,
3
};
if
(
axes
==
hw_axes
and
keep_dims
)
if
(
axes
==
hw_axes
and
keep_dims
)
{
{
op
::
pooling
op
{
"average"
};
op
::
pooling
op
{
"average"
};
...
@@ -362,19 +362,19 @@ struct tf_parser
...
@@ -362,19 +362,19 @@ struct tf_parser
// the last dim contains the left padding and right padding respectively
// the last dim contains the left padding and right padding respectively
std
::
vector
<
std
::
pair
<
int32_t
,
int32_t
>>
pad_per_dim
(
ndims
);
std
::
vector
<
std
::
pair
<
int32_t
,
int32_t
>>
pad_per_dim
(
ndims
);
auto
tf_padding
=
args
[
1
]
->
eval
().
get
<
int32_t
>
().
to_vector
();
auto
tf_padding
=
args
[
1
]
->
eval
().
get
<
int32_t
>
().
to_vector
();
for
(
size_t
i
=
0
;
i
<
2
*
ndims
;
i
+=
2
)
for
(
size_t
i
=
0
;
i
<
2
*
ndims
;
i
+=
2
)
{
{
pad_per_dim
[
i
/
2
].
first
=
tf_padding
[
i
];
pad_per_dim
[
i
/
2
].
first
=
tf_padding
[
i
];
pad_per_dim
[
i
/
2
].
second
=
tf_padding
[
i
+
1
];
pad_per_dim
[
i
/
2
].
second
=
tf_padding
[
i
+
1
];
}
}
reorder_data
(
pad_per_dim
);
reorder_data
(
pad_per_dim
);
op
::
pad
op
;
op
::
pad
op
;
std
::
vector
<
int64_t
>
pads
(
ndims
*
2
);
std
::
vector
<
int64_t
>
pads
(
ndims
*
2
);
for
(
size_t
i
=
0
;
i
<
ndims
;
i
++
)
for
(
size_t
i
=
0
;
i
<
ndims
;
i
++
)
{
{
pads
[
i
]
=
pad_per_dim
[
i
].
first
;
pads
[
i
]
=
pad_per_dim
[
i
].
first
;
pads
[
i
+
ndims
]
=
pad_per_dim
[
i
].
second
;
pads
[
i
+
ndims
]
=
pad_per_dim
[
i
].
second
;
}
}
op
.
pads
=
pads
;
op
.
pads
=
pads
;
return
prog
.
add_instruction
(
op
,
args
.
front
());
return
prog
.
add_instruction
(
op
,
args
.
front
());
...
...
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