code: def im2col_cpu(
      img,
      kh,
      kw,
      sy,
      sx,
      ph,
      pw,
      pval=0,
      cover_all=False,
      dy=1,
      dx=1,
      out_h=None,
      out_w=None,
  ):
      n, c, h, w = img.shape
      if out_h is None:
          out_h = get_conv_outsize(h, kh, sy, ph, cover_all, dy)
      assert out_h > 0, "Height in the output should be positive."
      if out_w is None:
          out_w = get_conv_outsize(w, kw, sx, pw, cover_all, dx)
      assert out_w > 0, "Width in the output should be positive."
  
      img = numpy.pad(
          img,
          ((0, 0), (0, 0), (ph, ph + sy - 1), (pw, pw + sx - 1)),
          mode="constant",
          constant_values=(pval,),
      )
      col = numpy.ndarray((n, c, kh, kw, out_h, out_w), dtype=img.dtype)
  
      for j in six.moves.range(kh):
          jdy = j * dy
          j_lim = jdy + sy * out_h
          for i in six.moves.range(kw):
              idx = i * dx
              i_lim = idx + sx * out_w
              col[:, :, j, i, :, :] = img[
                  :, :, jdy:j_lim:sy, idx:i_lim:sx
              ]
  
      return col
  
file_path: chainer/chainer/utils/conv.py
imports: import numpy
  import six
  from chainer.backends import cuda
label_desc: Use image node_id 3 for calling a global function with example usage: im2col_cpu(img, kh, kw, sy, sx, ph, pw, pval, cover_all, dy, dx, out_h, out_w) and returns: col