From c37198f4e2ffd63339c3266646152018aa106193 Mon Sep 17 00:00:00 2001 From: Alexander Pivovarov Date: Wed, 22 Jan 2020 16:47:15 -0800 Subject: [PATCH] pooling.cc improvements (#4767) --- src/relay/op/nn/pooling.cc | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/relay/op/nn/pooling.cc b/src/relay/op/nn/pooling.cc index 8f1115d56c83..6775b09e8aa9 100644 --- a/src/relay/op/nn/pooling.cc +++ b/src/relay/op/nn/pooling.cc @@ -134,10 +134,7 @@ bool Pool2DRel(const Array& types, return false; } - std::vector oshape; - for (const auto& e : dshape) { - oshape.push_back(e); - } + std::vector oshape(dshape.begin(), dshape.end()); if (dshape[hidx].as()) { oshape[hidx] = dshape[hidx]; @@ -775,10 +772,7 @@ bool Pool1DRel(const Array& types, return false; } - std::vector oshape; - for (const auto& e : dshape) { - oshape.push_back(e); - } + std::vector oshape(dshape.begin(), dshape.end()); if (dshape[widx].as()) { oshape[widx] = dshape[widx]; @@ -966,12 +960,9 @@ bool Pool3DRel(const Array& types, return false; } - std::vector oshape; - for (const auto& e : dshape) { - oshape.push_back(e); - } + std::vector oshape(dshape.begin(), dshape.end()); - std::vector idxes = {didx, hidx, widx}; + int idxes[3] = {didx, hidx, widx}; for (int i = 0; i < 3; i++) { int ii = idxes[i]; if (dshape[ii].as()) {