-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add dirichlet random sample op in cpu and gpu kernel #38244
Conversation
Thanks for your contribution! |
90af7b6
to
c8f7829
Compare
c8f7829
to
fa04fa8
Compare
fa04fa8
to
c8a90d5
Compare
c8a90d5
to
94ecdc0
Compare
94ecdc0
to
f346b2b
Compare
#define compat_exp exp | ||
#define compat_ceil ceil | ||
#define compat_floor floor | ||
#define compat_log log | ||
#define compat_pow pow | ||
#define compat_sqrt sqrt | ||
#define compat_tan tan | ||
#define compat_abs abs | ||
#define compat_log1p log1p | ||
#else | ||
#define compat_exp std::exp | ||
#define compat_ceil std::ceil | ||
#define compat_floor std::floor | ||
#define compat_log std::log | ||
#define compat_pow std::pow | ||
#define compat_sqrt std::sqrt | ||
#define compat_tan std::tan | ||
#define compat_abs std::abs | ||
#define compat_log1p std::log1p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macro's name use underline delimited all capital charactor nomenclature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
template <typename DeviceContext, typename T> | ||
struct DirichletSampler; | ||
|
||
template <typename scalar_t, typename sampler_t> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first letter of template parameter should be capitalized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have updated
#define compat_rand_init curand_init | ||
#define compat_rand_uniform curand_uniform | ||
#define compat_rand_normal curand_normal | ||
#elif defined(PADDLE_WITH_HIP) | ||
using compatRandStatePhilox4_32_10_t = hiprandStatePhilox4_32_10_t; | ||
#define compat_rand_init hiprand_init | ||
#define compat_rand_uniform hiprand_uniform | ||
#define compat_rand_normal hiprand_normal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macro's name use underline delimited all capital charactor nomenclature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have updated
template <typename scalar_t, typename accscalar_t, typename uniform_sampler_t, | ||
typename normal_sampler_t> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first letter of template parameter should be capitalized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have updated
|
||
namespace paddle { | ||
namespace operators { | ||
template <typename T, typename uniform_sampler_t, typename normal_sampler_t> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first letter of template parameter should be capitalized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have updated
* WIP: add dirichlet sample op * add cuda kernel for dirichlet op
f346b2b
to
818d4fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
New features
PR changes
OPs
Describe
Dirichlet and Beta distribution API need fast dirichlet random generator for draw sample data, we implement it in cpu and cuda backend use reject-accept sample and inverse-transform sample method.