<s> from collections import OrderedDict <EOL> from . . interfaces import Optimizer <EOL> class SGD ( Optimizer ) : <EOL> def __init__ ( self , loss ) : <EOL> super ( ) . __init__ ( loss ) <EOL> def _get_updates ( self ) : <EOL> return { } <EOL> def _get_directions ( self ) : <EOL> directions = OrderedDict ( ) <EOL> for param , gradient in self . loss . gradients . items ( ) : <EOL> directions [ param ] = - gradient <EOL> return directions <EOL> def getstate ( self ) : <EOL> state = { "<STR_LIT:version>" : <NUM_LIT:1> } <EOL> return state <EOL> def setstate ( self , state ) : <EOL> pass </s>
