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

Function arange_fill

include/common.h:292–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290
291template <class DType>
292void arange_fill(DType* tensor, std::vector<int> shape, int bound = 1024) {
293 int length =
294 std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<int>());
295 for (int i = 0; i < length; ++i) {
296 tensor[i] = (DType)((i % bound));
297 }
298}
299
300template <class DType>
301void constant_fill(DType* tensor, std::vector<int> shape, DType value) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected