pretrained_word_embedding_TF_nn.py 文件源码

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

项目:Text-Classification-with-Tensorflow 作者: jrzaurin 项目源码 文件源码
def max_pool1d_layer(inp, ksize, strides):
    """tf.nn does not have max_pool_1d, so we have to expand the incoming layer
    as if we were dealing with a 2D convolution and then squeeze it again.
    Again, since this is a 1D conv, the size of the window (ksize) and the stride
    of the sliding window must have only one dimension (height) != 1
    """
    x = tf.expand_dims(inp, 3)
    x = tf.nn.max_pool(x, ksize=ksize, strides=strides, padding="VALID")
    x = tf.squeeze(x, [3])
    return x
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号