code: def col2im_gpu(col, sy, sx, ph, pw, h, w, dy=1, dx=1):
      n, c, kh, kw, out_h, out_w = col.shape
      img = cuda.cupy.empty((n, c, h, w), dtype=col.dtype)
      cuda.elementwise(
          "raw T col, int32 h, int32 w, int32 out_h, int32 out_w,"
          "int32 kh, int32 kw, int32 sy, int32 sx, int32 ph, int32 pw,"
          "int32 dx, int32 dy",
          "T img",
          """
             int c0 = i / (h * w);
             int y  = i / w % h;
             int x  = i % w;
             T val = 0;
             for (int ky = 0; ky < kh; ++ky) {
               int out_y = (y + ph - ky * dy);
               if (0 > out_y || out_y >= out_h * sy) continue;
               if (out_y % sy != 0) continue;
               out_y /= sy;
               for (int kx = 0; kx < kw; ++kx) {
                 int out_x = (x + pw - kx * dx);
                 if (0 > out_x || out_x >= out_w * sx) continue;
                 if (out_x % sx != 0) continue;
                 out_x /= sx;
                 int k = out_y + out_h * (kx + kw * (ky + kh * c0));
                 val = val + col[out_x + out_w * k];
               }
             }
             img = val;
          """,
          "col2im",
      )(
          col.reduced_view(),
          h,
          w,
          out_h,
          out_w,
          kh,
          kw,
          sy,
          sx,
          ph,
          pw,
          dx,
          dy,
          img,
      )
      return img
  
file_path: chainer/chainer/utils/conv.py
imports: import numpy
  import six
  from chainer.backends import cuda
label_desc: Use image node_id 7 for calling a global function with example usage: col2im_gpu(col, sy, sx, ph, pw, h, w, dy, dx) and returns: img