Skip to content
Snippets Groups Projects
Commit 422809c4 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Added primitive benchmark

parent a6371d58
No related branches found
No related tags found
2 merge requests!152Update Aidge export to take a graph view has an argument instead of a...,!138Alternative graph matching
......@@ -11,6 +11,8 @@
#include <catch2/catch_test_macros.hpp>
#include <fmt/chrono.h>
#include "aidge/data/Tensor.hpp"
#include "aidge/graph/GraphView.hpp"
#include "aidge/graph/Testing.hpp"
......@@ -219,4 +221,31 @@ TEST_CASE("[core/graph] Matching") {
{"relu1", {"relu1", "conv2_pad"}}
});
}
SECTION("Conv->ReLU [perf]") {
const size_t nbTests = 10;
std::mt19937::result_type seed(1);
for (int test = 0; test < nbTests; ++test) {
RandomGraph randGraph;
randGraph.types = {"Conv", "ReLU"};
randGraph.typesWeights = {0.9, 0.1};
const auto g1 = std::make_shared<GraphView>("g1");
Log::setConsoleLevel(Log::Warn);
g1->add(randGraph.gen(seed, 100));
auto gm = SinglePassGraphMatching(g1);
const auto start = std::chrono::system_clock::now();
const auto results = gm.match("Conv->ReLU");
const auto end = std::chrono::system_clock::now();
const auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
REQUIRE(results.size() > 0);
++seed;
fmt::print("Found: {} - duration: {}\n", results.size(), duration);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment