logistic_regression_visual.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:DeepLearning 作者: STHSF 项目源码 文件源码
def add_layer(inputs, in_size, out_size, activation_function=None):

    # add one more layer and return the output of this layer
    # ?????????? layer???? ???
    with tf.name_scope('layer'):
        # ??????
        with tf.name_scope('weights_1'):
            weights = tf.Variable(tf.random_normal([in_size, out_size]), name='W')
        with tf.name_scope('biases_1'):
            biases = tf.Variable(tf.zeros([1, out_size]) + 0.1, name='b')
        with tf.name_scope('wx_plus_b'):
            wx_plus_b = tf.add(tf.matmul(inputs, weights), biases)

            # here to dropout, ? wx_plus_b ?drop?????, keep_prob ??????drop?????? sess.run ? feed
            wx_plus_b = tf.nn.dropout(wx_plus_b, keep_prob=1)

        if activation_function is None:
            outputs = wx_plus_b
        else:
            outputs = activation_function(wx_plus_b, )

        return outputs

# define placeholder for inputs to network
# ?????????? inputs x?y
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号