@@ -33,8 +33,8 @@ def __init__(self, input_type, pos):
33
33
# Otherwise, trainer uses MultiGradientMachine which will transfer
34
34
# data from CPU to GPU in the forward function, set data_in_gpu to
35
35
# False in this case.
36
- self .data_in_gpu = True if swig_paddle .isUsingGpu () and (
37
- swig_paddle .getTrainerCount () == 1 ) else False
36
+ self .data_in_gpu = swig_paddle .isUsingGpu (
37
+ ) and swig_paddle .getTrainerCount () == 1
38
38
39
39
def scan (self , dat ):
40
40
pass
@@ -63,7 +63,7 @@ def finish_scan(self, argument):
63
63
if self .__mat__ .dtype != numpy .float32 :
64
64
self .__mat__ = self .__mat__ .astype (numpy .float32 )
65
65
m = swig_paddle .Matrix .createDenseFromNumpy (self .__mat__ , True ,
66
- self .use_gpu )
66
+ self .data_in_gpu )
67
67
argument .setSlotValue (self .pos , m )
68
68
69
69
@@ -115,7 +115,7 @@ def scan(self, dat):
115
115
self .__ids__ .append (dat )
116
116
117
117
def finish_scan (self , argument ):
118
- ids = swig_paddle .IVector .create (self .__ids__ , self .use_gpu )
118
+ ids = swig_paddle .IVector .create (self .__ids__ , self .data_in_gpu )
119
119
assert isinstance (argument , swig_paddle .Arguments )
120
120
argument .setSlotIds (self .pos , ids )
121
121
0 commit comments