Skip to content
Snippets Groups Projects
Commit 2189f66d authored by Jerome Hue's avatar Jerome Hue
Browse files

randomize beta in leaky unit test

parent dacd8ee3
No related branches found
No related tags found
No related merge requests found
Pipeline #64352 passed
...@@ -757,6 +757,7 @@ TEST_CASE("[cpu/operator] MetaOperator", "[MetaOperator][CPU]") { ...@@ -757,6 +757,7 @@ TEST_CASE("[cpu/operator] MetaOperator", "[MetaOperator][CPU]") {
std::uniform_int_distribution<std::size_t> nbDimsDist(std::size_t(3), std::uniform_int_distribution<std::size_t> nbDimsDist(std::size_t(3),
std::size_t(3)); std::size_t(3));
std::uniform_int_distribution<int> boolDist(0, 1); std::uniform_int_distribution<int> boolDist(0, 1);
std::uniform_real_distribution<float> betaDist(0,1);
const std::size_t nbDims = nbDimsDist(gen); const std::size_t nbDims = nbDimsDist(gen);
Log::info("Nbdims : {}", nbDims); Log::info("Nbdims : {}", nbDims);
...@@ -771,8 +772,9 @@ TEST_CASE("[cpu/operator] MetaOperator", "[MetaOperator][CPU]") { ...@@ -771,8 +772,9 @@ TEST_CASE("[cpu/operator] MetaOperator", "[MetaOperator][CPU]") {
} }
const auto nbTimeSteps = dims[0]; const auto nbTimeSteps = dims[0];
const auto beta = betaDist(gen);
auto myLeaky = Leaky(nbTimeSteps, 0.9, 1.0, "leaky"); auto myLeaky = Leaky(nbTimeSteps, beta, 1.0, "leaky");
auto op = auto op =
std::static_pointer_cast<MetaOperator_Op>(myLeaky->getOperator()); std::static_pointer_cast<MetaOperator_Op>(myLeaky->getOperator());
// auto stack = Stack(2); // auto stack = Stack(2);
...@@ -856,7 +858,7 @@ TEST_CASE("[cpu/operator] MetaOperator", "[MetaOperator][CPU]") { ...@@ -856,7 +858,7 @@ TEST_CASE("[cpu/operator] MetaOperator", "[MetaOperator][CPU]") {
for (int j = 0; j < nbElementsPerTimeStep; ++j) { for (int j = 0; j < nbElementsPerTimeStep; ++j) {
auto reset = (result[prev + j] > 1.0 ? 1 : 0); auto reset = (result[prev + j] > 1.0 ? 1 : 0);
result[offset + j] = result[offset + j] =
result[prev + j] * 0.9 + input[offset + j] - reset; result[prev + j] * beta + input[offset + j] - reset;
} }
} }
......
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