Skip to content

Instantly share code, notes, and snippets.

@Bartzi
Bartzi / bilinear_interpolation.py
Created June 12, 2017 08:57
Bilinear Interpolation with Chainer
from chainer import Function
from chainer import cuda
from chainer.utils import type_check, force_array
def cupy_place(arr, mask, val):
_place_kernel = cuda.cupy.ElementwiseKernel(
'T a, S mask, T val',
'T out',
'out = mask ? val : a',