提交 566e5f1f 编写于 作者: D dangqingqing

rename use_gpu to data_in_gpu

上级 8c87ab7a
...@@ -33,8 +33,8 @@ class IScanner(object): ...@@ -33,8 +33,8 @@ class IScanner(object):
# Otherwise, trainer uses MultiGradientMachine which will transfer # Otherwise, trainer uses MultiGradientMachine which will transfer
# data from CPU to GPU in the forward function, set data_in_gpu to # data from CPU to GPU in the forward function, set data_in_gpu to
# False in this case. # False in this case.
self.data_in_gpu = True if swig_paddle.isUsingGpu() and ( self.data_in_gpu = swig_paddle.isUsingGpu(
swig_paddle.getTrainerCount() == 1) else False ) and swig_paddle.getTrainerCount() == 1
def scan(self, dat): def scan(self, dat):
pass pass
...@@ -63,7 +63,7 @@ class DenseScanner(IScanner): ...@@ -63,7 +63,7 @@ class DenseScanner(IScanner):
if self.__mat__.dtype != numpy.float32: if self.__mat__.dtype != numpy.float32:
self.__mat__ = self.__mat__.astype(numpy.float32) self.__mat__ = self.__mat__.astype(numpy.float32)
m = swig_paddle.Matrix.createDenseFromNumpy(self.__mat__, True, m = swig_paddle.Matrix.createDenseFromNumpy(self.__mat__, True,
self.use_gpu) self.data_in_gpu)
argument.setSlotValue(self.pos, m) argument.setSlotValue(self.pos, m)
...@@ -115,7 +115,7 @@ class IndexScanner(IScanner): ...@@ -115,7 +115,7 @@ class IndexScanner(IScanner):
self.__ids__.append(dat) self.__ids__.append(dat)
def finish_scan(self, argument): def finish_scan(self, argument):
ids = swig_paddle.IVector.create(self.__ids__, self.use_gpu) ids = swig_paddle.IVector.create(self.__ids__, self.data_in_gpu)
assert isinstance(argument, swig_paddle.Arguments) assert isinstance(argument, swig_paddle.Arguments)
argument.setSlotIds(self.pos, ids) argument.setSlotIds(self.pos, ids)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册