#NEWLINE# @ attr . gpu #NEWLINE# def check_accumulate_grads_from_gpu( self , src_id ) : #NEWLINE# #INDENT# with cuda . Device ( src_id ) : #NEWLINE# #INDENT# self . optimizer . accumulate_grads ( [ cuda . cupy . arange ( 3 ) ] ) #NEWLINE# #UNINDENT# grad = self . target . param . grad #NEWLINE# self . assertTrue ( ( cuda . to_cpu ( grad ) == ( np . arange ( 3 ) * 2 ) ) . all ( ) )