from typing import OrderedDict


def vanilla_sgd(params, grads, learning_rate):
    """
    Update rules for vanilla SGD. Based on the update functions from
    Lasagne (https://github.com/Lasagne/Lasagne)
    
    The update is computed as
    
        param := param - learning_rate * gradient
        
    Parameters
    ----------
    params        : list of shared varaibles that will be updated
    grads         : list of symbolic expressions that produce the gradients
    learning_rate : step size
    
    Returns
    -------
    A dictionary mapping each parameter in params to their update expression
    
    """
    updates = OrderedDict()

    for param, grad in zip(params, grads):
        updates[param] = param - learning_rate * grad

    return updates