code: def col2im_nd_cpu(col, stride, pad, dims, dilate=1):
      n, c = col.shape[:2]  # (n, c, kx_1, ..., kx_N, out_1, ..., out_N)
      mid = (len(col.shape) - 2) // 2 + 2
      ksize = col.shape[2:mid]
      outs = col.shape[mid:]
      colon = slice(None)
      ndim = len(outs)
      dilate = as_tuple(dilate, ndim)
      assert len(ksize) == len(stride) == len(pad) == len(dims) == ndim
  
      # Image with padded size.
      img_shape = (n, c) + tuple(
          d + 2 * p + s - 1 for (d, p, s) in zip(dims, pad, stride)
      )
      img = numpy.zeros(img_shape, dtype=col.dtype)
      for kxs in itertools.product(
          *[six.moves.range(k) for k in ksize]
      ):
          # (:, :, kx_1:kx_lim_1:s_1, ..., kx_N:kx_lim_N:s_N)
          kx_dilate = tuple(kx * di for (kx, di) in zip(kxs, dilate))
          kx_lims = tuple(
              kx_di + s * out
              for (kx_di, s, out) in zip(kx_dilate, stride, outs)
          )
          img_index = (colon, colon) + tuple(
              slice(kx_di, kx_lim, s)
              for (kx_di, kx_lim, s) in zip(kx_dilate, kx_lims, stride)
          )
          # (:, :, kx_1, kx_2, ..., kx_N, :, :, ..., :)
          col_index = (colon, colon) + kxs + (colon,) * len(outs)
          img[img_index] += col[col_index]
  
      # (:, :, p_1:d_1 + p_1, p_2:d_2 + p_2, ..., p_N:d_N + p_N]
      img_index = (colon, colon) + tuple(
          slice(p, d + p) for (p, d) in zip(pad, dims)
      )
      return img[img_index]
  
file_path: chainer/chainer/utils/conv_nd.py
imports: import itertools
  import numpy
  import six
  from chainer.backends import cuda
  from chainer.utils.conv import get_conv_outsize
  from chainer.utils import conv_nd_kernel
label_desc: Use image node_id 5 for calling a global function with example usage: col2im_nd_cpu(col, stride, pad, dims, dilate) and returns: img