code: def _compile_loop(self, ndim, outs, ks, ss, ps, xs, dilate):
      # 2D: for (int kx_0 = 0; kx_0 < k_0; ++kx_0) {
      #     int out_x_0 = x_0 + p_0 - kx_0 * di_0;
      #     if (0 > out_x_0 || out_x_0 >= out_0 * s_0) continue;
      #     if (out_x_0 % s_0 != 0) continue;
      #     out_x_0 /= s_0;
      #     for (int kx_1 = 0; kx_1 < k_1; ++kx_1) {
      #       int out_x_1 = x_1 + p_1 - kx_1 * di_1;
      #       if (0 > out_x_1 || out_x_1 >= out_1 * s_1) continue;
      #       if (out_x_1 % s_1 != 0) continue;
      #       out_x_1 /= s_1;
      #       ... Main-part here ...
      #     }
      #   }
      #   ... After-part here ...
      def _loop_main(main, ndim, ks, ss):
          w = Writer()
  
          # Loop openings.
          out_xs = vars("out_x", ndim)
          kxs = vars("kx", ndim)
          for out, out_x, kx, s, p, x, k, di in six.moves.zip(
              outs, out_xs, kxs, ss, ps, xs, ks, dilate
          ):
              w.write(
                  "for (int {} = 0; {} < {}; ++{}) {{".format(
                      kx, kx, k, kx
                  ),
                  indent="inc",
              )
              w.write(
                  "int {} = {} + {} - {} * {};".format(
                      out_x, x, p, kx, di
                  )
              )
              w.write(
                  "if (0 > {} || {} >= {} * {}) continue;".format(
                      out_x, out_x, out, s
                  )
              )
              w.write("if ({} % {} != 0) continue;".format(out_x, s))
              w.write("{} /= {};".format(out_x, s))
  
          # Main-part.
          for l in main(ks, kxs, out_xs).split("\n"):
              w.write(l)
  
          # Loop closings.
          for _ in out_xs:
              w.write("}", indent="dec")
  
          return [w.get()]
  
      return _loop_main
  
imports: import functools
  import six
  from chainer.backends import cuda
label_desc: Use image node_id 5 for calling the Col2imNDKernel obj's underlying member method code with example usage: obj._compile_loop(ndim, outs, ks, ss, ps, xs, dilate) and returns: _loop_main, list