def sgd(loss_or_grads, params, learning_rate):
 grads = get_or_compute_grads(loss_or_grads, params)
 updates = OrderedDict()
 for (param, grad) in zip(params, grads):
  updates[param] = (param - (learning_rate * grad))
 return updates

def sgd ( loss_or_grads , params , learning_rate ) : grads = get_or_compute_grads ( loss_or_grads , params ) updates = OrderedDict ( ) for ( param , grad ) in zip ( params , grads ) : updates [ param ] = ( param - ( learning_rate * grad ) ) return updates
stochastic gradient descent updates generates update expressions of the form: * param := param - learning_rate * gradient parameters loss_or_grads : symbolic expression or list of expressions a scalar loss expression .