MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / initData

Function initData

examples/matmul/run.cpp:638–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638void initData(size_t M, size_t K, size_t N, std::unique_ptr<float[]> &inputPtr,
639 std::unique_ptr<float[]> &weightsPtr) {
640 std::mt19937 gen(314159);
641 randn(inputPtr.get(), M * K, gen);
642 randn(weightsPtr.get(), N * K, gen);
643 // randint(inputPtr.get(), M * K, gen, 1, 2);
644 // randint(weightsPtr.get(), N * K, gen, 1, 2);
645 LOG(kDefLog, kInfo, "%s", show<float>(inputPtr.get(), M, K, "Input").c_str());
646 LOG(kDefLog, kInfo, "%s",
647 show<float>(weightsPtr.get(), N, K, "Weights").c_str());
648}
649
650void initData(size_t M, size_t K, size_t N, std::unique_ptr<half[]> &inputPtr,
651 std::unique_ptr<half[]> &weightsPtr) {

Callers 1

runTestWithCheckFunction · 0.70

Calls 2

randnFunction · 0.85
LOGFunction · 0.85

Tested by

no test coverage detected