a003d7d85c61bc74b88ad0d3b8d07834fe9636ea,deeppavlov/models/evolution/utils.py,Attention,build,#Attention#Any#,151

Before Change


        if self.context_length is None:
            self.context_length = input_shape[-1]

        self.context = self.add_weight(tuple(input_shape[:-1] + (self.context_length,)),
                                       initializer=self.init)

        self.W = self.add_weight((input_shape[-1] + self.context_length, input_shape[-1], ),
                                 initializer=self.init,
                                 regularizer=self.W_regularizer,
                                 constraint=self.W_constraint)

        if self.use_bias:
            self.b = self.add_weight((input_shape[-1], ),
                                     initializer="zero",
                                     regularizer=self.b_regularizer,
                                     constraint=self.b_constraint)
        else:
            self.b = None

        self.built = True

After Change



        super(Attention, self).__init__(**kwargs)

    def build(self, input_shape):
        assert len(input_shape) == 3

        if self.context_length is None:
            self.context_length = input_shape[-1]

        self.context = self.add_weight(tuple((self.context_length, input_shape[-1])),
                                       name="context",
                                       initializer=self.init)

        self.W = self.add_weight((2 * input_shape[-1], 1,),
                                 name="w",
                                 initializer=self.init,
                                 regularizer=self.W_regularizer,
                                 constraint=self.W_constraint)

        if self.use_bias:
            self.b = self.add_weight((1, ),
                                     name="b",
                                     initializer="zero",
                                     regularizer=self.b_regularizer,
                                     constraint=self.b_constraint)
        else:
            self.b = None
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 14

Instances


Project Name: deepmipt/DeepPavlov
Commit Name: a003d7d85c61bc74b88ad0d3b8d07834fe9636ea
Time: 2018-06-26
Author: dilyara.rimovna@gmail.com
File Name: deeppavlov/models/evolution/utils.py
Class Name: Attention
Method Name: build


Project Name: deepmipt/DeepPavlov
Commit Name: 688d4ead1098429b45dc53f4fedd303e8413829d
Time: 2018-04-20
Author: dilyara.rimovna@gmail.com
File Name: deeppavlov/models/evolution/utils.py
Class Name: Attention
Method Name: build


Project Name: Hironsan/anago
Commit Name: 7c54ef6464c5d2885faf3e8b3ad60451d1894d7a
Time: 2018-05-28
Author: hiroki.nakayama.py@gmail.com
File Name: anago/layers.py
Class Name: ChainCRF
Method Name: build