mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
improve code quality
- eliminate rand() calls - non initialized members/ variables - unused return values - missing/useless NULL checks
This commit is contained in:
@@ -40,17 +40,18 @@ TEST(Padding_Halide, Accuracy)
|
||||
{
|
||||
static const int kNumRuns = 10;
|
||||
std::vector<int> paddings(8);
|
||||
cv::RNG& rng = cv::theRNG();
|
||||
for (int t = 0; t < kNumRuns; ++t)
|
||||
{
|
||||
for (int i = 0; i < paddings.size(); ++i)
|
||||
paddings[i] = rand() % 5;
|
||||
paddings[i] = rng(5);
|
||||
|
||||
LayerParams lp;
|
||||
lp.set("paddings", DictValue::arrayInt<int*>(&paddings[0], paddings.size()));
|
||||
lp.type = "Padding";
|
||||
lp.name = "testLayer";
|
||||
|
||||
Mat input({1 + rand() % 10, 1 + rand() % 10, 1 + rand() % 10, 1 + rand() % 10}, CV_32F);
|
||||
Mat input({1 + rng(10), 1 + rng(10), 1 + rng(10), 1 + rng(10)}, CV_32F);
|
||||
test(lp, input);
|
||||
}
|
||||
}
|
||||
@@ -633,7 +634,7 @@ TEST_P(Eltwise, Accuracy)
|
||||
eltwiseParam.set("operation", op);
|
||||
if (op == "sum" && weighted)
|
||||
{
|
||||
RNG rng = cv::theRNG();
|
||||
RNG& rng = cv::theRNG();
|
||||
std::vector<float> coeff(1 + numConv);
|
||||
for (int i = 0; i < coeff.size(); ++i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user