     }
     ConvCheckDevice(x, w, b);
     ConvCheckDtype(x, w, b);
+    ConvCheckNdim(w, stride, pad);
 
     int8_t ndim = w.ndim() - 2;
-    assert(ndim > 0);
 
     // w.shape = (in_channels, out_channels, k_1, k_2, ..., k_N)
     int64_t out_channels = w.shape()[1];

    }
    if (b && b->dtype() != x.dtype()) {
        throw XchainerError{
            "XChainer cuDNN requires the bias array dtype: ", b->dtype(), " and the input array dtype: ", x.dtype(), " are same"};
    }
}


    }
    ConvCheckDevice(x, w, b);
    ConvCheckDtype(x, w, b);
    ConvCheckNdim(w, stride, pad);

    int8_t ndim = w.ndim() - 2;  // Number of spacial dimensions

    // w.shape = (out_channels, _, k_1, k_2, ..., k_N)
    int64_t out_channels = w.shape()[0];
