def compute_df(input_size, hidden_layers, output_size=1):
    """
    Compute degrees of freedom of a neural net (number of trainable params)

    input_size :    (int) size of the input layer
    hidden_layers : (list) list specifiying size of hidden layers
    latentsize :    (int) number of hidden units for each layer

    df : (int) degrees of freedom
    """
    nn_arch = [input_size] + hidden_layers + [output_size]
    df = sum(map(lambda x, y : x*(y+1), nn_arch[1:], nn_arch[:-1]))
    return df