MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / RandomShape

Function RandomShape

oneflow/api/cpp/tests/api_test.cpp:33–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31namespace oneflow_api {
32
33Shape RandomShape() {
34 thread_local static std::mt19937 rng(std::random_device{}());
35 std::uniform_int_distribution<> dist_ndim(1, 4), dist_dims(16, 64);
36 std::vector<std::int64_t> dims(dist_ndim(rng), 0);
37 for (auto& x : dims) { x = dist_dims(rng); }
38 return Shape(dims);
39}
40
41template<typename T>
42std::vector<T> RandomData(size_t size) {

Callers 3

TESTFunction · 0.85
TestReluFunction · 0.85
TESTFunction · 0.85

Calls 1

ShapeClass · 0.50

Tested by

no test coverage detected