def update_parameters(parameters, gradients, learning_rate):
    """
    Performs a gradient descent update.
    :param parameters: weights and bias units
    :param gradients: partial derivatives w.r.t. the weights and the bias units
    :param learning_rate: gradient descent step size
    :return: updated gradients
    """
    L = len(parameters) // 2

    for l in range(1, L + 1):
        parameters['W' + str(l)] = parameters['W' + str(l)] - learning_rate * gradients['dW' + str(l)]
        parameters['b' + str(l)] = parameters['b' + str(l)] - learning_rate * gradients['db' + str(l)]

    return parameters