MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / exec

Method exec

dnn/src/cambricon/rng/opr_impl.cpp:42–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 : UniformRNG(handle), m_rand_handle(cnnl_handle(handle)) {}
41
42void 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
53GaussianRNGImpl::GaussianRNGImpl(Handle* handle)
54 : GaussianRNG(handle), m_rand_handle(cnnl_handle(handle)) {}

Callers

nothing calls this directly

Calls 9

cnnl_handleFunction · 0.85
convert_to_cnnl_datatypeFunction · 0.85
ensure_seedMethod · 0.45
enumvMethod · 0.45
handleMethod · 0.45
genMethod · 0.45
stateMethod · 0.45
total_nr_elemsMethod · 0.45
raw_ptrMethod · 0.45

Tested by

no test coverage detected