Commit ed9a29bc authored by Khalique's avatar Khalique
Browse files

formatting

parent 7accd407
......@@ -612,13 +612,12 @@ struct cpu_softmax
std::vector<value_type> batch_sum(batch_shape.elements(), value_type(0));
shape_for_each(output_shape, [&](auto idx) {
auto index = this->compute_batch_index(idx, batch_shape, op.axis);
auto index = this->compute_batch_index(idx, batch_shape, op.axis);
auto output_val = std::exp(output(idx.begin(), idx.end()));
output(idx.begin(), idx.end()) = output_val;
batch_sum[index] += output(idx.begin(), idx.end());
});
shape_for_each(output_shape, [&](auto idx) {
auto index = this->compute_batch_index(idx, batch_shape, op.axis);
output(idx.begin(), idx.end()) /= batch_sum[index];
......
......@@ -932,8 +932,8 @@ TEST_CASE(maxpool_test)
TEST_CASE(softmax_simple_test)
{
migraphx::program p;
std::vector<float> a = { 0.25, 0.75 };
std::vector<float> s = { 0.377541, 0.622459 };
std::vector<float> a = {0.25, 0.75};
std::vector<float> s = {0.377541, 0.622459};
migraphx::shape a_shape{migraphx::shape::float_type, {1, 2}};
auto al = p.add_literal(migraphx::literal{a_shape, a});
p.add_instruction(migraphx::op::softmax{}, al);
......
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