Commit 78cb524d authored by Paul's avatar Paul
Browse files

Fix incorrect stride calculation in reduce_mean

parent 95050fbd
...@@ -282,10 +282,7 @@ void reduce(hipStream_t stream, ...@@ -282,10 +282,7 @@ void reduce(hipStream_t stream,
std::prev(output_shape.lens().end()), std::prev(output_shape.lens().end()),
input_shape.lens().begin())) input_shape.lens().begin()))
{ {
std::size_t stride = std::accumulate(input_shape.strides().begin(), std::size_t stride = input_shape.strides().at(input_shape.strides().size() - 2);
input_shape.strides().end(),
1,
std::multiplies<size_t>());
reduce_standard_impl(stream, reduce_standard_impl(stream,
result, result,
arg, arg,
......
...@@ -3792,6 +3792,18 @@ struct test_reduce_mean : verify_program<test_reduce_mean> ...@@ -3792,6 +3792,18 @@ struct test_reduce_mean : verify_program<test_reduce_mean>
}; };
}; };
struct test_reduce_mean2 : verify_program<test_reduce_mean2>
{
migraphx::program create_program() const
{
migraphx::program p;
migraphx::shape s{migraphx::shape::float_type, {1, 128, 768}};
auto x = p.add_parameter("x", s);
p.add_instruction(migraphx::op::reduce_mean{{2}}, x);
return p;
};
};
struct test_reduce_mean_int : verify_program<test_reduce_mean_int> struct test_reduce_mean_int : verify_program<test_reduce_mean_int>
{ {
migraphx::program create_program() const migraphx::program create_program() const
......
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