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
a357cb7e
Commit
a357cb7e
authored
Jul 18, 2019
by
Khalique
Browse files
formatting
parent
1e56489a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
src/tf/tf.cpp
src/tf/tf.cpp
+8
-8
No files found.
src/tf/tf.cpp
View file @
a357cb7e
...
@@ -567,23 +567,23 @@ struct tf_parser
...
@@ -567,23 +567,23 @@ struct tf_parser
instruction_ref
instruction_ref
parse_onehot
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
parse_onehot
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
{
auto
indices
=
args
[
0
]
->
eval
().
get
<
int64_t
>
().
to_vector
();
auto
indices
=
args
[
0
]
->
eval
().
get
<
int64_t
>
().
to_vector
();
int
depth
=
args
[
1
]
->
eval
().
at
<
int32_t
>
();
int
depth
=
args
[
1
]
->
eval
().
at
<
int32_t
>
();
int
axis
=
-
1
;
int
axis
=
-
1
;
size_t
num_indices
=
indices
.
size
();
size_t
num_indices
=
indices
.
size
();
float
on_value
=
args
[
2
]
->
eval
().
at
<
float
>
();
float
on_value
=
args
[
2
]
->
eval
().
at
<
float
>
();
float
off_value
=
args
[
3
]
->
eval
().
at
<
float
>
();
float
off_value
=
args
[
3
]
->
eval
().
at
<
float
>
();
if
(
contains
(
attributes
,
"axis"
))
if
(
contains
(
attributes
,
"axis"
))
axis
=
attributes
.
at
(
"axis"
).
i
();
axis
=
attributes
.
at
(
"axis"
).
i
();
if
(
axis
==
-
1
)
if
(
axis
==
-
1
)
{
{
shape
s
{
shape
::
float_type
,
{
num_indices
,
static_cast
<
size_t
>
(
depth
)}};
shape
s
{
shape
::
float_type
,
{
num_indices
,
static_cast
<
size_t
>
(
depth
)}};
std
::
vector
<
float
>
output
(
num_indices
*
depth
);
std
::
vector
<
float
>
output
(
num_indices
*
depth
);
std
::
fill
(
output
.
begin
(),
output
.
end
(),
off_value
);
std
::
fill
(
output
.
begin
(),
output
.
end
(),
off_value
);
for
(
size_t
i
=
0
;
i
<
num_indices
;
i
++
)
for
(
size_t
i
=
0
;
i
<
num_indices
;
i
++
)
{
{
if
(
indices
[
i
]
>=
0
and
indices
[
i
]
<
num_indices
)
if
(
indices
[
i
]
>=
0
and
indices
[
i
]
<
num_indices
)
output
[
depth
*
i
+
indices
[
i
]]
=
on_value
;
output
[
depth
*
i
+
indices
[
i
]]
=
on_value
;
}
}
return
prog
.
add_literal
(
s
,
output
);
return
prog
.
add_literal
(
s
,
output
);
}
}
...
...
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