-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add prelu operator * clang format * add prelu to gpu lowering * add unit tests for the PRelu operator * clang format * add missing onnx file for PRelu operator * update unit tests for prelu operator * clang format Co-authored-by: mvermeulen <[email protected]> Co-authored-by: Paul Fultz II <[email protected]>
- Loading branch information
1 parent
a22189d
commit 63d8e40
Showing
13 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef MIGRAPHX_GUARD_OPERATORS_PRELU_HPP | ||
#define MIGRAPHX_GUARD_OPERATORS_PRELU_HPP | ||
|
||
#include <migraphx/op/binary.hpp> | ||
|
||
namespace migraphx { | ||
inline namespace MIGRAPHX_INLINE_NS { | ||
namespace op { | ||
|
||
struct prelu : binary<prelu> | ||
{ | ||
auto apply() const | ||
{ | ||
return [](auto x, auto slope) { return ((x < 0) ? (x * slope) : x); }; | ||
} | ||
}; | ||
|
||
} // namespace op | ||
} // namespace MIGRAPHX_INLINE_NS | ||
} // namespace migraphx | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <migraphx/gpu/device/prelu.hpp> | ||
#include <migraphx/gpu/device/nary.hpp> | ||
|
||
namespace migraphx { | ||
inline namespace MIGRAPHX_INLINE_NS { | ||
namespace gpu { | ||
namespace device { | ||
|
||
void prelu(hipStream_t stream, const argument& result, const argument& arg1, const argument& arg2) | ||
{ | ||
nary(stream, result, arg1, arg2)([](auto x, auto slope) | ||
__device__ { return ((x < 0) ? (x * slope) : x); }); | ||
} | ||
|
||
} // namespace device | ||
} // namespace gpu | ||
} // namespace MIGRAPHX_INLINE_NS | ||
} // namespace migraphx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
#ifndef MIGRAPHX_GUARD_RTGLIB_DEVICE_PRELU_HPP | ||
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_PRELU_HPP | ||
|
||
#include <migraphx/argument.hpp> | ||
#include <migraphx/config.hpp> | ||
#include <hip/hip_runtime_api.h> | ||
|
||
namespace migraphx { | ||
inline namespace MIGRAPHX_INLINE_NS { | ||
namespace gpu { | ||
namespace device { | ||
|
||
void prelu(hipStream_t stream, const argument& result, const argument& arg1, const argument& arg2); | ||
|
||
} // namespace device | ||
} // namespace gpu | ||
} // namespace MIGRAPHX_INLINE_NS | ||
} // namespace migraphx | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef MIGRAPHX_GUARD_RTGLIB_PRELU_HPP | ||
#define MIGRAPHX_GUARD_RTGLIB_PRELU_HPP | ||
|
||
#include <migraphx/gpu/oper.hpp> | ||
#include <migraphx/gpu/device/prelu.hpp> | ||
|
||
namespace migraphx { | ||
inline namespace MIGRAPHX_INLINE_NS { | ||
namespace gpu { | ||
|
||
struct hip_prelu : binary_device<hip_prelu, device::prelu> | ||
{ | ||
}; | ||
|
||
} // namespace gpu | ||
} // namespace MIGRAPHX_INLINE_NS | ||
} // namespace migraphx | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
prelu_brcst_test:w | ||
0 | ||
1out"PReluprelu_brcst_testZ | ||
0 | ||
Z | ||
1 | ||
b | ||
out | ||
B |