     strides: (Int, Int, Int, Int),
     padding: Padding
 ) -> Tensor<Scalar> {
+    precondition(input.shape.rank == 4, "The input must have rank 4.")
+    precondition(filter.shape.rank == 4, "The filter must have rank 4.")
     return _Raw.depthwiseConv2dNative(
         input,
         filter: filter,

    padding: Padding = .valid,
    dilations: (Int, Int, Int, Int) = (1, 1, 1, 1)
) -> Tensor<Scalar> {
    return _Raw.conv2D(
        input,
        filter: filter,

    strides: (Int, Int, Int, Int, Int) = (1, 1, 1, 1, 1),
    padding: Padding = .valid
) -> Tensor<Scalar> {
    precondition(input.shape.rank == 5, "The input must have rank 5.")
    precondition(filter.shape.rank == 5, "The filter must have rank 5.")
    return _Raw.conv3D(
        input,
        filter: filter,
