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

Function gen_rand_data

src/cambricon/test/magicmind_runtime_opr.cpp:22–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20namespace {
21template <typename T>
22void gen_rand_data(std::vector<T>& data, size_t num_elems, size_t scale) {
23 unsigned int seed = time(0);
24 data.resize(num_elems);
25 for (size_t i = 0; i < num_elems; ++i) {
26 data[i] =
27 static_cast<T>((rand_r(&seed) % (scale * 1000)) / 1000.0 - scale / 2.0);
28 }
29}
30
31template <typename T>
32void get_min_max(std::vector<T>& data, double& min, double& max) {

Callers 2

buildMethod · 0.85
TESTFunction · 0.85

Calls 1

resizeMethod · 0.80

Tested by

no test coverage detected