From e0daa04c4712d1d084319d65b601a47f757b4d5a Mon Sep 17 00:00:00 2001 From: Michal Pandy Date: Wed, 4 Sep 2019 02:53:13 -0700 Subject: [PATCH] aSD --- .../SCN/Metadata/SubmanifoldConvolutionRules.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sparseconvnet/SCN/Metadata/SubmanifoldConvolutionRules.h b/sparseconvnet/SCN/Metadata/SubmanifoldConvolutionRules.h index d9908ce..dc2c7ec 100644 --- a/sparseconvnet/SCN/Metadata/SubmanifoldConvolutionRules.h +++ b/sparseconvnet/SCN/Metadata/SubmanifoldConvolutionRules.h @@ -31,7 +31,7 @@ double SubmanifoldConvolution_SgToRules(SparseGrid &grid, double countActiveInputs = 0; const Int threadCount = 4; std::vector threads; - int activeInputs[threadCount] = {0}; + std::array activeInputs = {}; std::vector rulebooks; for (Int t = 0; t < threadCount; ++t) { rulebooks.push_back(RuleBook(rules.size())); @@ -39,7 +39,9 @@ double SubmanifoldConvolution_SgToRules(SparseGrid &grid, auto func = [&](const int order) { auto outputIter = grid.mp.begin(); + auto &rb = rulebooks[order]; int rem = grid.mp.size(); + int aciveInputCount = 0; if (rem > order) { std::advance(outputIter, order); @@ -54,15 +56,14 @@ double SubmanifoldConvolution_SgToRules(SparseGrid &grid, for (auto inputPoint : inRegion) { auto inputIter = grid.mp.find(inputPoint); if (inputIter != grid.mp.end()) { - activeInputs[order]++; - rulebooks[order][rulesOffset].push_back(inputIter->second + - grid.ctr); - rulebooks[order][rulesOffset].push_back(outputIter->second + - grid.ctr); + aciveInputCount++; + rb[rulesOffset].push_back(inputIter->second + grid.ctr); + rb[rulesOffset].push_back(outputIter->second + grid.ctr); } rulesOffset++; } } + activeInputs[order] = aciveInputCount; } };