0

次のコードを使用して損失を計算すると、2次元配列があります。

_roi_score = roi_score[row_index, col_index]
gt_roi_label_lst = gt_roi_label_lst[row_index, col_index]
loss = F.sigmoid_cross_entropy(roi_score, gt_roi_label_lst)  # multi label

逆伝播中、コード レポート エラー:

File "AU_rcnn/train.py", line 249, in main
   trainer.run()
 File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0b1-py3.6.egg/chainer/training/trainer.py", line 324, in run
   six.reraise(*sys.exc_info())
 File "/usr/local/anaconda3/lib/python3.6/site-packages/six.py", line 686, in reraise
   raise value
 File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0b1-py3.6.egg/chainer/training/trainer.py", line 310, in run
   update()
 File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0b1-py3.6.egg/chainer/training/updater.py", line 223, in update
   self.update_core()
 File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0b1-py3.6.egg/chainer/training/updater.py", line 367, in update_core
   loss.backward()
 File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0b1-py3.6.egg/chainer/variable.py", line 916, in backward
   target_input_indexes, out_grad, in_grad)
 File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0b1-py3.6.egg/chainer/function_node.py", line 486, in backward_accumulate
   gxs = self.backward(target_input_indexes, grad_outputs)
 File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0b1-py3.6.egg/chainer/function.py", line 124, in backward
   gxs = self._function.backward(in_data, grad_out_data)
 File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0b1-py3.6.egg/chainer/functions/connection/linear.py", line 56, in backward
   gb = gy.sum(0)
 File "cupy/core/core.pyx", line 967, in cupy.core.core.ndarray.sum
 File "cupy/core/core.pyx", line 975, in cupy.core.core.ndarray.sum
 File "cupy/core/reduction.pxi", line 216, in cupy.core.core.simple_reduction_function.__call__
 File "cupy/core/elementwise.pxi", line 102, in cupy.core.core._preprocess_args
ValueError: Array device must be same as the current device: array device = 1 while current = 0

GPUを1つしか使用していませんが、表示されました。これを引き起こした理由は何ですか、私は長い間立ち往生しています。

4

0 に答える 0