Skip to content
Snippets Groups Projects
Commit e7e7137f authored by Houssem ROUIS's avatar Houssem ROUIS
Browse files

clean test

parent 63a80c68
No related branches found
No related tags found
No related merge requests found
Pipeline #42488 failed
......@@ -242,7 +242,7 @@ TEST_CASE("[gpu/operator] AvgPooling(forward)", "[AvgPooling][GPU]") {
const std::size_t nbDims = nbDimsDist(gen);
std::vector<std::size_t> dims;
for (std::size_t i = 0; i < nbDims; ++i) {
dims.push_back(4);
dims.push_back(dimSizeDist(gen));
}
const std::size_t nb_elements = std::accumulate(dims.cbegin(), dims.cend(), std::size_t(1), std::multiplies<std::size_t>());
......@@ -269,18 +269,12 @@ TEST_CASE("[gpu/operator] AvgPooling(forward)", "[AvgPooling][GPU]") {
for (size_t n = 0; n < kernel; n++)
{
sum += array0[i * matSize + (r + m) * cols + c + n];
}
}
}
result.push_back(sum/(kernel*kernel));
}
}
}
// energy based model
//adversarial attacks: add noise on image so perturber le modèle
// white box attacks and black box attacks
// langevin sampling
// Run inference
op->computeOutputDims();
......@@ -289,13 +283,10 @@ TEST_CASE("[gpu/operator] AvgPooling(forward)", "[AvgPooling][GPU]") {
end = std::chrono::system_clock::now();
duration += std::chrono::duration_cast<std::chrono::microseconds>(end - start);
std::cout << "---------output" << std::endl;
op->getOutput(0)->print();
float* computedOutput = static_cast<float*>(op->getOutput(0)->getImpl()->rawPtr());
for (size_t i = 0; i < op->getOutput(0)->size(); i++)
{
std::cout << "i " << i << " computed: "<< computedOutput[i] << ", expected " << result[i] << std::endl;
// REQUIRE(approxEq<float>(computedOutput[i], result[i]));
REQUIRE(abs(computedOutput[i] - result[i]) < 1e-6);
}
......
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