reduce_mean.cpp 584 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#include <migraphx/gpu/device/reduce_mean.hpp>
#include <migraphx/gpu/device/reduce.hpp>

namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {

void reduce_mean(hipStream_t stream, const argument& result, const argument& arg)
{
    std::size_t batch_item_num = arg.get_shape().elements() / result.get_shape().elements();
Shucai Xiao's avatar
Shucai Xiao committed
12
    float factor               = 1.0f / batch_item_num;
13
14
15
16
17
18
19
    reduce(stream, result, arg, sum{}, 0, id{}, scale{factor});
}

} // namespace device
} // namespace gpu
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx