MCPcopy Create free account
hub / github.com/KnowingNothing/MatmulTutorial / alloc_cpu_tensor

Function alloc_cpu_tensor

include/common.h:276–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274
275template <class DType>
276DType* 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
282template <class DType>
283void random_fill(DType* tensor, std::vector<int> shape) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected