Skip to content

Commit

Permalink
fix compilation of truncated_gaussian_random_op, test=develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Avin0323 committed Apr 20, 2021
1 parent ffaf62e commit da39ea4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions paddle/fluid/operators/truncated_gaussian_random_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ namespace paddle {
namespace operators {

template <typename T>
struct TruncatedNormal {
struct GPUTruncatedNormal {
T mean, std;
T a_normal_cdf;
T b_normal_cdf;
unsigned int seed;
T numeric_min;

__host__ __device__ TruncatedNormal(T mean, T std, T numeric_min, int seed)
__host__ __device__ GPUTruncatedNormal(T mean, T std, T numeric_min, int seed)
: mean(mean), std(std), seed(seed), numeric_min(numeric_min) {
a_normal_cdf = (1.0 + erff(-2.0 / sqrtf(2.0))) / 2.0;
b_normal_cdf = (1.0 + erff(2.0 / sqrtf(2.0))) / 2.0;
Expand Down Expand Up @@ -113,10 +113,10 @@ class GPUTruncatedGaussianRandomKernel : public framework::OpKernel<T> {
TruncatedNormalOffset<T>(mean, std, std::numeric_limits<T>::min(),
seed_offset.first, gen_offset));
} else {
thrust::transform(
index_sequence_begin, index_sequence_begin + size,
thrust::device_ptr<T>(data),
TruncatedNormal<T>(mean, std, std::numeric_limits<T>::min(), seed));
thrust::transform(index_sequence_begin, index_sequence_begin + size,
thrust::device_ptr<T>(data),
GPUTruncatedNormal<T>(
mean, std, std::numeric_limits<T>::min(), seed));
}
}
};
Expand Down

1 comment on commit da39ea4

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.