Commit c5703af4 authored by Paul's avatar Paul
Browse files

Format

parent ec6b5022
...@@ -34,8 +34,9 @@ __device__ void softmax(Input input, Output output) ...@@ -34,8 +34,9 @@ __device__ void softmax(Input input, Output output)
{ {
reduce::block::run<reduce::with_axis<Input, Axis>>([&](auto, auto r) { reduce::block::run<reduce::with_axis<Input, Axis>>([&](auto, auto r) {
const auto c = vec_at(r.slice(input)[0], 0); const auto c = vec_at(r.slice(input)[0], 0);
auto batch_sum = r.reduce( auto batch_sum = r.reduce(op::sum{}, 0, [&](auto x) {
op::sum{}, 0, [&](auto x) { return migraphx::convert<float>(migraphx::exp(x - c)); })(input); return migraphx::convert<float>(migraphx::exp(x - c));
})(input);
r.inner([&](auto& y, auto x) { y = migraphx::exp(x - c) / batch_sum; })(output, input); r.inner([&](auto& y, auto x) { y = migraphx::exp(x - c) / batch_sum; })(output, input);
}); });
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment