<s> from chainer import cuda <EOL> from chainer import optimizer <EOL> class SGD ( optimizer . GradientMethod ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , lr = <NUM_LIT> ) : <EOL> self . lr = lr <EOL> def update_one_cpu ( self , param , state ) : <EOL> param . data -= self . lr * param . grad <EOL> def update_one_gpu ( self , param , state ) : <EOL> cuda . elementwise ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) ( param . grad , self . lr , param . data ) </s>
