| 40 | : UniformRNG(handle), m_rand_handle(cnnl_handle(handle)) {} |
| 41 | |
| 42 | void UniformRNGImpl::exec(_megdnn_tensor_inout dst, _megdnn_workspace workspace) { |
| 43 | check_exec(dst.layout, workspace.size); |
| 44 | megdnn_assert(dst.layout.dtype == dtype::Float32(), "only float32 supported"); |
| 45 | m_rand_handle.ensure_seed(cnnl_handle(handle()), m_param.seed); |
| 46 | auto cnnl_dtype = convert_to_cnnl_datatype(dst.layout.dtype.enumv()); |
| 47 | cnnl_check(cnnlRandGenerateUniform( |
| 48 | cnnl_handle(this->handle()), m_rand_handle.gen(), cnnl_dtype, |
| 49 | m_rand_handle.state(), dst.layout.total_nr_elems(), /*min=*/0.f, |
| 50 | /*max=*/1.f, dst.raw_ptr())); |
| 51 | } |
| 52 | |
| 53 | GaussianRNGImpl::GaussianRNGImpl(Handle* handle) |
| 54 | : GaussianRNG(handle), m_rand_handle(cnnl_handle(handle)) {} |
nothing calls this directly
no test coverage detected