pretrained_word_embedding_TF_nn.py 文件源码

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

项目:Text-Classification-with-Tensorflow 作者: jrzaurin 项目源码 文件源码
def dense_layer(inp, n_neurons):
    # input to a fully connected layer -> 2D [batch_size, n_inputs]
    n_inputs = int(inp.shape[1])
    W = tf.Variable(tf.truncated_normal((n_inputs,n_neurons), stddev=0.1))
    b = tf.Variable(tf.random_normal(shape=[n_neurons]))
    # or if you prefer
    # b = tf.Variable(tf.zeros([n_neurons]))
    x = tf.matmul(inp,W) + b
    x = tf.nn.relu(x)
    return x
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号