Tensorflow add_layer

def add_layer(input,in_size,out_size,activation_fuction=None):
    Weight = tf.Variable(tf.random.normal([in_size,out_size]))
    biases  = tf.Variable(tf.random.normal([1,out_size]))    
    wx = input*Weight+biases
    
    if activation_fuction is None:
        output = wx
    else :
        output = activation_fuction(wx)
    return output 

 

posted @ 2020-04-01 20:47  小娜子成长记  阅读(207)  评论(0编辑  收藏  举报