tests/test_hyper_gradients.py
def build_model(augment=0, variable_initializer=(tf.zeros, tf.zeros)):
    """
    Simple model for test purposes on minist
    
    :param augment: 
    :param variable_initializer: 
    :return: 
    """
    mnist = load_mnist()
    x = tf.placeholder(tf.float32)
    y = tf.placeholder(tf.float32)
    lin_model = LinearModel(x, 28 * 28, 10,
                            active_gen_kwars={'init_w': variable_initializer[0],
                                              'init_b': variable_initializer[1]})

    all_w, mod_y, mat_w = vectorize_model(lin_model.var_list, lin_model.inp[-1], lin_model.Ws[0], augment=augment)

    error = tf.reduce_mean(
        cross_entropy_loss(mod_y, y)
    )

    correct_prediction = tf.equal(tf.argmax(mod_y, 1), tf.argmax(y, 1))
    accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float"))

    return mnist, x, y, all_w, mod_y, mat_w, error, accuracy

    Simple model for test purposes on minist
    
    :param augment: 
    :param variable_initializer: 
    :return: 
    
Simple model for test purposes on minist
Simple model for test purposes on minist
def build_model(augment=0, variable_initializer=(tf.zeros, tf.zeros)):
    mnist = load_mnist()
    x = tf.placeholder(tf.float32)
    y = tf.placeholder(tf.float32)
    lin_model = LinearModel(x, 28 * 28, 10,
                            active_gen_kwars={'init_w': variable_initializer[0],
                                              'init_b': variable_initializer[1]})
    all_w, mod_y, mat_w = vectorize_model(lin_model.var_list, lin_model.inp[-1], lin_model.Ws[0], augment=augment)
    error = tf.reduce_mean(
        cross_entropy_loss(mod_y, y)
    )
    correct_prediction = tf.equal(tf.argmax(mod_y, 1), tf.argmax(y, 1))
    accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float"))
    return mnist, x, y, all_w, mod_y, mat_w, error, accuracy
def build_model ( augment = 0 , variable_initializer = ( tf . zeros , tf . zeros ) ) : mnist = load_mnist ( ) x = tf . placeholder ( tf . float32 ) y = tf . placeholder ( tf . float32 ) lin_model = LinearModel ( x , 28 * 28 , 10 , active_gen_kwars = { 'init_w' : variable_initializer [ 0 ] , 'init_b' : variable_initializer [ 1 ] } ) all_w , mod_y , mat_w = vectorize_model ( lin_model . var_list , lin_model . inp [ - 1 ] , lin_model . Ws [ 0 ] , augment = augment ) error = tf . reduce_mean ( cross_entropy_loss ( mod_y , y ) ) correct_prediction = tf . equal ( tf . argmax ( mod_y , 1 ) , tf . argmax ( y , 1 ) ) accuracy = tf . reduce_mean ( tf . cast ( correct_prediction , "float" ) ) return mnist , x , y , all_w , mod_y , mat_w , error , accuracy
Simple model for test purposes on minist
Simple model for test purposes on minist
"""
    Simple model for test purposes on minist
    
    :param augment: 
    :param variable_initializer: 
    :return: 
    """
None
augment
None
variable_initializer
None