add_relu.cpp 852 Bytes
Newer Older
1
2
#include <migraph/gpu/device/add_relu.hpp>
#include <migraph/gpu/device/nary.hpp>
Paul's avatar
Paul committed
3
4

namespace migraph {
5
namespace MIGRAPH_INLINE_NS {
Paul's avatar
Paul committed
6
7
8
namespace gpu {
namespace device {

Paul's avatar
Paul committed
9
10
11
12
void add_relu(hipStream_t stream,
              const argument& result,
              const argument& arg1,
              const argument& arg2)
Paul's avatar
Paul committed
13
{
Paul's avatar
Paul committed
14
15
    nary(stream, result, arg1, arg2)(
        [](auto x, auto y) { return std::max<decltype(x + y)>(0, x + y); });
Paul's avatar
Paul committed
16
17
}

Paul's avatar
Paul committed
18
19
void add_relu(hipStream_t stream,
              const argument& result,
Paul's avatar
Paul committed
20
21
22
23
              const argument& arg1,
              const argument& arg2,
              const argument& arg3)
{
Paul's avatar
Paul committed
24
    nary(stream, result, arg1, arg2, arg3)(
Paul's avatar
Paul committed
25
26
27
        [](auto x, auto y, auto z) { return std::max<decltype(x + y + z)>(0, x + y + z); });
}

Paul's avatar
Paul committed
28
29
} // namespace device
} // namespace gpu
30
} // namespace MIGRAPH_INLINE_NS
Paul's avatar
Paul committed
31
} // namespace migraph