From 0d8d786a72256d53ba6dd1d01b6905b0e72d3fbf Mon Sep 17 00:00:00 2001 From: aliPMPAINT Date: Sun, 3 Jan 2021 19:21:23 +0330 Subject: [PATCH 1/2] Fix cpp example in readme --- README.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6ea807535..36eb0e2ee 100644 --- a/README.md +++ b/README.md @@ -104,14 +104,17 @@ int main() { // 3. Run multiplication operation synchronously mgr.evalOpDefault( - { tensorInA, tensorInB, tensorOut }) + { tensorInA, tensorInB, tensorOut }); // 4. Map results back from GPU memory to print the results - mgr.evalOpDefault({ tensorInA, tensorInB, tensorOut }) + mgr.evalOpDefault({ tensorInA, tensorInB, tensorOut }); // Prints the output which is Output: { 2, 4, 6 } - std::cout << fmt::format("Output: {}", - tensorOut.data()) << std::endl; + std::cout<< "Output: { "; + for (const float& elem : tensorOut->data()) { + std::cout << elem << " "; + } + std::cout << "}" << std::endl; } ``` @@ -157,9 +160,9 @@ int main() { sq->begin(); // 5.2. Record batch commands - sq->recordrecordrecordrecord({ tensorInA }); + sq->record({ tensorInB }); + sq->record({ tensorOut }); // 5.3. Explicitly stop recording batch commands sq->end(); @@ -168,8 +171,11 @@ int main() { sq->eval(); // Prints the output which is Output: { 2, 4, 6 } - std::cout << fmt::format("Output: {}", - tensorOut.data()) << std::endl; + std::cout<< "Output: { "; + for (const float& elem : tensorOut->data()) { + std::cout << elem << " "; + } + std::cout << "}" << std::endl; } ``` From 68160243f773b1dfaae0acd34adb52046822cc93 Mon Sep 17 00:00:00 2001 From: aliPMPAINT <53617231+aliPMPAINT@users.noreply.github.com> Date: Sun, 3 Jan 2021 19:24:49 +0330 Subject: [PATCH 2/2] Small fixes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36eb0e2ee..64025b883 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ int main() { mgr.evalOpDefault({ tensorInA, tensorInB, tensorOut }); // Prints the output which is Output: { 2, 4, 6 } - std::cout<< "Output: { "; + std::cout << "Output: { "; for (const float& elem : tensorOut->data()) { std::cout << elem << " "; } @@ -171,7 +171,7 @@ int main() { sq->eval(); // Prints the output which is Output: { 2, 4, 6 } - std::cout<< "Output: { "; + std::cout << "Output: { "; for (const float& elem : tensorOut->data()) { std::cout << elem << " "; }