random_op.cu 583 字节
Newer Older
D
dongzhihong 已提交
1 2 3
#include "paddle/operators/random_op.h"
#include "paddle/framework/op_registry.h"

D
dongzhihong 已提交
4 5 6
namespace paddle {
namespace operators {

D
dongzhihong 已提交
7 8 9 10
template <typename T>
bool Gaussian(platform::CUDADeviceContext &ctx, framework::Tensor* output,
              const int size, const T& mean, const T& std, const T& seed) {
  auto g = RandGenerator(seed);
D
dongzhihong 已提交
11 12 13 14 15 16 17
  return curandGenerateNormal(g, output, size, mean, std);
}

} // operators
} // paddle


D
dongzhihong 已提交
18 19
typedef paddle::operators::RandomOpKernel<paddle::platform::GPUPlace, float>
  RandomOpKernel_GPU_float;
D
dongzhihong 已提交
20
REGISTER_OP_GPU_KERNEL(random, RandomOpKernel_GPU_float);