043d176e63960102db551b2b5739721c0467a43e,thinc/neural/_classes/multiheaded_attention.py,MultiHeadedAttention,begin_update,#MultiHeadedAttention#Any#Any#,232

Before Change


        assert Xattns[0].shape == (lengths[0], X.shape[1]), (Xattns[0].shape, X.shape[1])
        Xattn = self.ops.flatten(Xattns)
        assert Xattn.shape == X.shape
        Y, get_dXattn = self.get_output.begin_update(Xattn, drop=drop)

        def backprop_self_attn(dY, sgd=None):
            dXattn = get_dXattn(dY, sgd=sgd)
            dXattns = self.ops.unflatten(dXattn, lengths)

After Change



    def begin_update(self, inputs, drop=0.0):
        (Qs, Ks, Vs), get_d_inputs = self.handle_inputs(inputs, drop=drop)
        Y, get_dQs_dKs_dVs = self.attend((Qs, Ks, Vs), drop=drop)
        outputs, get_dY = self.handle_outputs(Y, inputs)

        def backprop_self_attn(d_outputs, sgd=None):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: explosion/thinc
Commit Name: 043d176e63960102db551b2b5739721c0467a43e
Time: 2019-06-10
Author: honnibal+gh@gmail.com
File Name: thinc/neural/_classes/multiheaded_attention.py
Class Name: MultiHeadedAttention
Method Name: begin_update


Project Name: explosion/thinc
Commit Name: cbfac37056179bb32492eaf9e65112ae38c8973e
Time: 2018-03-28
Author: daniel@recogn.ai
File Name: examples/wrap_pytorch_rnn.py
Class Name:
Method Name: check_learns_zero_output_rnn


Project Name: explosion/thinc
Commit Name: 88b225923e0038774a31028079ed0f6c226e7990
Time: 2018-03-28
Author: daniel@recogn.ai
File Name: examples/wrap_pytorch_rnn.py
Class Name:
Method Name: check_learns_zero_output_rnn