Commit 325dd90a authored by Paul's avatar Paul
Browse files

Format

parent 65d1ea59
...@@ -39,10 +39,9 @@ __device__ void softmax(Input input1, Output output) ...@@ -39,10 +39,9 @@ __device__ void softmax(Input input1, Output output)
#else #else
const auto c = r.reduce(op::max{}, lowest{}, op::id{})(input); const auto c = r.reduce(op::max{}, lowest{}, op::id{})(input);
#endif #endif
auto exp_in = r.inner([&](auto x) { auto exp_in = r.inner([&](auto x) { return migraphx::exp(x - c); })(input);
return migraphx::exp(x - c); auto batch_sum =
})(input); r.reduce(op::sum{}, 0, [](auto x) { return migraphx::convert<float>(x); })(exp_in);
auto batch_sum = r.reduce(op::sum{}, 0, [](auto x) { return migraphx::convert<float>(x); })(exp_in);
r.inner([&](auto& y, auto x) { y = x / batch_sum; })(output, exp_in); r.inner([&](auto& y, auto x) { y = x / batch_sum; })(output, exp_in);
}); });
} }
......
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