| 281 | |
| 282 | template <class DType> |
| 283 | void random_fill(DType* tensor, std::vector<int> shape) { |
| 284 | int length = |
| 285 | std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<int>()); |
| 286 | for (int i = 0; i < length; ++i) { |
| 287 | tensor[i] = (DType)((rand() % 1000 * 1 / 100 % 10 - 5.0)); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | template <class DType> |
| 292 | void arange_fill(DType* tensor, std::vector<int> shape, int bound = 1024) { |
nothing calls this directly
no outgoing calls
no test coverage detected