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

Function constant_fill

include/common.h:301–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299
300template <class DType>
301void constant_fill(DType* tensor, std::vector<int> shape, DType value) {
302 int length =
303 std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<int>());
304 for (int i = 0; i < length; ++i) {
305 tensor[i] = value;
306 }
307}
308
309template <class DType>
310DType* alloc_gpu_tensor(std::vector<int> shape) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected