Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
4c1e707b
Commit
4c1e707b
authored
May 23, 2019
by
Khalique
Browse files
fix test cases, revert code
parent
366d4f83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
src/targets/gpu/device/softmax.cpp
src/targets/gpu/device/softmax.cpp
+14
-4
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+1
-1
No files found.
src/targets/gpu/device/softmax.cpp
View file @
4c1e707b
...
...
@@ -33,12 +33,22 @@ argument softmax(hipStream_t stream,
std
::
size_t
row_start
=
i
*
n_dims
;
// get max
auto
batch_max
=
input_ptr
[
row_start
];
for
(
std
::
size_t
j
=
0
;
j
<
n_dims
;
++
j
)
for
(
std
::
size_t
j
=
1
;
j
<
n_dims
;
++
j
)
{
auto
ind
=
row_start
+
j
;
auto
hip_type_input
=
to_hip_type
(
input_ptr
[
ind
]);
batch_max
=
std
::
max
(
to_hip_type
(
batch_max
),
hip_type_input
);
output_ptr
[
ind
]
=
::
exp
(
hip_type_input
);
batch_max
=
std
::
max
(
to_hip_type
(
batch_max
),
to_hip_type
(
input_ptr
[
ind
]));
}
for
(
std
::
size_t
j
=
0
;
j
<
n_dims
;
++
j
)
{
auto
ind
=
row_start
+
j
;
output_ptr
[
ind
]
=
input_ptr
[
ind
]
-
batch_max
;
}
for
(
std
::
size_t
j
=
0
;
j
<
n_dims
;
++
j
)
{
auto
ind
=
row_start
+
j
;
output_ptr
[
ind
]
=
exp
(
to_hip_type
(
input_ptr
[
ind
]));
}
auto
batch_sum
=
output_ptr
[
row_start
];
...
...
test/gpu/miopen.cpp
View file @
4c1e707b
...
...
@@ -574,7 +574,7 @@ struct test_softmax : verify_program<test_softmax>
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
x
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
3
,
4
,
2
}});
auto
x
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
3
,
1
,
1
}});
p
.
add_instruction
(
migraphx
::
op
::
softmax
{},
x
);
return
p
;
}
...
...
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