| 31 | namespace oneflow_api { |
| 32 | |
| 33 | Shape 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 | |
| 41 | template<typename T> |
| 42 | std::vector<T> RandomData(size_t size) { |