pooling.cc improvements (#4767)
authorAlexander Pivovarov <apivovarov@gmail.com>
Thu, 23 Jan 2020 00:47:15 +0000 (16:47 -0800)
committerWuwei Lin <wuwei@apache.org>
Thu, 23 Jan 2020 00:47:14 +0000 (19:47 -0500)
src/relay/op/nn/pooling.cc

index 8f1115d..6775b09 100644 (file)
@@ -134,10 +134,7 @@ bool Pool2DRel(const Array<Type>& types,
     return false;
   }
 
-  std::vector<IndexExpr> oshape;
-  for (const auto& e : dshape) {
-    oshape.push_back(e);
-  }
+  std::vector<IndexExpr> oshape(dshape.begin(), dshape.end());
 
   if (dshape[hidx].as<tir::AnyNode>()) {
     oshape[hidx] = dshape[hidx];
@@ -775,10 +772,7 @@ bool Pool1DRel(const Array<Type>& types,
     return false;
   }
 
-  std::vector<IndexExpr> oshape;
-  for (const auto& e : dshape) {
-    oshape.push_back(e);
-  }
+  std::vector<IndexExpr> oshape(dshape.begin(), dshape.end());
 
   if (dshape[widx].as<tir::AnyNode>()) {
     oshape[widx] = dshape[widx];
@@ -966,12 +960,9 @@ bool Pool3DRel(const Array<Type>& types,
     return false;
   }
 
-  std::vector<IndexExpr> oshape;
-  for (const auto& e : dshape) {
-    oshape.push_back(e);
-  }
+  std::vector<IndexExpr> oshape(dshape.begin(), dshape.end());
 
-  std::vector<int> 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<tir::AnyNode>()) {