attention.py 文件源码

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

项目:ikelos 作者: braingineer 项目源码 文件源码
def build(self, input_shape):
        self.input_spec = [InputSpec(ndim=3)]
        if K._BACKEND == 'tensorflow':
            if not input_shape[1]:
                raise Exception('When using TensorFlow, you should define '
                                'explicitly the number of timesteps of '
                                'your sequences.\n'
                                'If your first layer is an Embedding, '
                                'make sure to pass it an "input_length" '
                                'argument. Otherwise, make sure '
                                'the first layer has '
                                'an "input_shape" or "batch_input_shape" '
                                'argument, including the time axis.')

        if not self.layer.built:
            self.layer.build(input_shape)
            self.layer.built = True

        super(ProbabilityTensor, self).build()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号