roi_pooling実装記録


chainerの実装
https://github.com/chainer/chainer/blob/master/chainer/functions/pooling/roi_pooling_2d.pycpuとgpuの別々の実現があります
gpuの実装にはcudaが用いる.Elementwise、遡及.次のコードが得られます.
@memoize()
def elementwise(in_params, out_params, operation, name, **kwargs):
    """Creates an elementwise kernel function.
    This function uses :func:`~chainer.backends.cuda.memoize` to cache the
    kernel object, i.e. the resulting kernel object is cached for each argument
    combination and CUDA device.
    The arguments are the same as those for
    :class:`cupy.ElementwiseKernel`, except that the ``name`` argument is
    mandatory.
    """
    check_cuda_available()
    return cupy.ElementwiseKernel(
        in_params, out_params, operation, name, **kwargs)

だからchainerのroi_poolingはcupyで実現されます.もう一度デバッグして、テストコードを出します.