- estimate array is in GPU or CPU
from chainer import backend
import chainer
import numpy as np
a = chaienr.as_variable(np.ones(shape=(2,2)))
xp = backend.get_array_module(a)
if xp.__name__ == 'numpy':
print('this is in CPU')
a.to_gpu(0)
xp = backend.get_array_module(a)
if xp.__name__ == 'cupy':
print('this is in GPU')