| 274 | |
| 275 | template <class DType> |
| 276 | DType* alloc_cpu_tensor(std::vector<int> shape) { |
| 277 | return (DType*)malloc( |
| 278 | std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<int>()) * |
| 279 | sizeof(DType)); |
| 280 | } |
| 281 | |
| 282 | template <class DType> |
| 283 | void random_fill(DType* tensor, std::vector<int> shape) { |
nothing calls this directly
no outgoing calls
no test coverage detected