SparseFullyConnectedLayer.py 文件源码

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

项目:MatchZoo 作者: faneshion 项目源码 文件源码
def build(self, input_shape):
        assert len(input_shape) == 2
        input_dim = input_shape[1]
        #self.input_spec = InputSpec(dtype=K.floatx(), shape=(None, input_dim))
        self.input_spec = InputSpec(ndim=2, axes={1: input_dim})

        self.W = self.add_weight(
                shape=(input_dim, self.output_dim),
                initializer=self.W_initializer,
                name='SparseFullyConnected_W',
                regularizer=self.W_regularizer,
                constraint=self.W_constraint)
        self.b = self.add_weight(
                shape=(self.output_dim,),
                initializer=self.b_initializer,
                name='SparseFullyConnected_b',
                regularizer=self.b_regularizer,
                constraint=self.b_constraint)


        if self.initial_weights is not None:
            self.set_weights(self.initial_weights)
            del self.initial_weights
        #self.built = True
        #super(SparseFullyConnectedLayer, self).build(input_shape)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号