larroy commented on a change in pull request #11778: [MXNET-483] C++ tests for 
mkldnn convolution operator
URL: https://github.com/apache/incubator-mxnet/pull/11778#discussion_r207380881
 
 

 ##########
 File path: tests/cpp/operator/mkldnn.cc
 ##########
 @@ -557,33 +614,34 @@ void PrintVerifyMsg(const NDArrayAttrs &arr1, const 
NDArrayAttrs &arr2) {
  *
  *  num_inputs / dim arguments used to scale shape (used for concat backwards 
to enlarge input shapes)
  */
-std::vector<NDArrayAttrs> GetTestInputArrays(bool rand = false, int num_inputs 
= 1, int dim = 0) {
+std::vector<NDArrayAttrs> GetTestInputArrays(bool rand = false,
+                                             std::vector<float> scale = {1}) {
   TestArrayShapes tas = GetTestArrayShapes();
   std::vector<nnvm::TShape> shapes = tas.shapes;
   std::vector<mkldnn::memory::primitive_desc> pds = tas.pds;
 
   std::vector<NDArrayAttrs> in_arrs;
   std::string desc;
 
-  int slice_amount = 1;
-  if (dim == 0)
-    slice_amount = num_inputs;
+  int slice_amount = scale[0];
   for (auto shape : shapes) {
-    if (dim >= shape.ndim())
+    if (scale.size() > shape.ndim())
       continue;
-    shape[dim] = shape[dim] * num_inputs;
+
+    for (int dim = 0; dim < scale.size(); dim++)
+      shape[dim] = static_cast<int>(round(shape[dim] * scale[dim]));
 
     // Type 1.
     NDArray arr(shape, Context());
     in_arrs.emplace_back(arr, "Normal NDArray");
     InitDefaultArray(&in_arrs.back().arr, rand);
     for (auto pd : pds) {
-      if (num_inputs > 1) {
+      for (int dim = 0; dim < scale.size(); dim++) {
 
 Review comment:
   size_t, otherwise signed vs unsigned comparison warning

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to