chainer / chainercv

ChainerCV: a Library for Deep Learning in Computer Vision
MIT License
1.48k stars 304 forks source link

Change Request in chainercv/examples/fpn/train_multi.py #941

Closed yechanp closed 4 years ago

yechanp commented 4 years ago

Hello,

line 61 in TrainChain Class in chainercv/examples/fpn/train_multi.py ,

I think x = np.zeros( (len(imgs), 3, pad_size[0], pad_size[1]), dtype=np.float32) should be changed to x = self.xp.zeros( (len(imgs), 3, pad_size[0], pad_size[1]), dtype=np.float32) because when model is gpu-mode, the model use cupy instead of using numpy. Am I right?

Hakuyume commented 4 years ago

Current code is correct. In FPN example, all arguments of TrainChain.forward is CPU array. They are sent to GPU in https://github.com/chainer/chainercv/blob/master/examples/fpn/train_multi.py#L66-L69.