chainer.functions.copy(x, dst)[source]

入力値を指定されたデバイスへコピーする。

 

この関数は入力値の配列を dstによって指定されたデバイスへコピーします。 dst == -1のとき、この関数は配列をホストメモリー上へコピーします。この関数はホストからホストへ、ホストからデバイスへ、デバイスからデバイスへ、そしてデバイスからホストへのコピーをサポートしています。

 

Parameters:
Returns:

出力値

Return type:

Variable

 

Example

 


>>>
import chainer.cuda as cuda
>>> x = np.random.uniform(-1, 1, (5, 10))
>>> cuda.get_device_from_array(x).id
-1
>>> y = F.copy(x, 0) # from host to device0
>>> cuda.get_device_from_array(y.data).id
0
>>> z = F.copy(y, -1) # from device0 to host
>>> cuda.get_device_from_array(z.data).id
-1