Fix padding params check for conv-cudnn.

Reviewed By: dutran

Differential Revision: D5169744

fbshipit-source-id: 3d1c50328eefed01fb9d4daa84478c45cd0aa5fd
diff --git a/caffe2/operators/conv_op_cudnn.cc b/caffe2/operators/conv_op_cudnn.cc
index 1ee0e4e..e50259c 100644
--- a/caffe2/operators/conv_op_cudnn.cc
+++ b/caffe2/operators/conv_op_cudnn.cc
@@ -58,14 +58,12 @@
     CHECK(!deterministic_ || !exhaustive_search_);
     CAFFE_ENFORCE(group_ > 0);
     CAFFE_ENFORCE(!deterministic_ || !exhaustive_search_);
-    OPERATOR_NEEDS_FEATURE(
-        pad_t() == pad_b(),
-        "The current padding scheme leads to unequal padding on the top and "
-        "bottom, which is not supported by cudnn.");
-    OPERATOR_NEEDS_FEATURE(
-        pad_l() == pad_r(),
-        "The current padding scheme leads to unequal padding on the left "
-        "and right, which is not supported by cudnn.");
+    for (int i = 0; i < kernel_.size(); ++i) {
+      OPERATOR_NEEDS_FEATURE(
+          pads_[i] == pads_[kernel_.size() + i],
+          "The current padding scheme leads to unequal padding on the left "
+          "and right, which is not supported by cudnn.");
+    }
     // dilated convolution supported by some algorithms in cuDNN v6
 #if !(CUDNN_VERSION_MIN(6,0,0))
     OPERATOR_NEEDS_FEATURE(