cnn_encoder.py 文件源码

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

项目:neuralmonkey 作者: ufal 项目源码 文件源码
def image_processing_layers(self) -> List[tf.Tensor]:
        """Do all convolutions and return the last conditional map.

        Applies convolutions on the input tensor with optional max pooling.
        All the intermediate layers are stored in the `image_processing_layers`
        attribute.  There is not dropout between the convolutional layers, by
        default the activation function is ReLU.
        """
        last_layer = self.image_input
        image_processing_layers = []  # type: List[tf.Tensor]

        with tf.variable_scope("convolutions"):
            for i, (filter_size,
                    n_filters,
                    pool_size) in enumerate(self.convolutions):
                with tf.variable_scope("cnn_layer_{}".format(i)):
                    last_layer = conv2d(last_layer, n_filters, filter_size)
                    image_processing_layers.append(last_layer)

                    if pool_size:
                        last_layer = max_pool2d(last_layer, pool_size)
                        image_processing_layers.append(last_layer)

        return image_processing_layers
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号