8701128a21b2460583687d7ac77fc5bf3fb65356,thinc/neural/_classes/multiheaded_attention.py,MultiHeadedAttention,begin_update,#MultiHeadedAttention#,26
Before Change
q1 = q0.reshape(nB, -1, self.nH, self.nD)
k0, get_dy0_1 = self.linears[1].begin_update(y0)
k1 = k0.reshape(nB, -1, self.nH, self.nD)
v0, get_dy0_2 = self.linears[2].begin_update(y0)
v1 = v0.reshape(nB, -1, self.nH, self.nD)
x1, get_dq1_dk1_dv1 = self.attn(q1, k1, v1, mask=mask)
x2 = x1.reshape(x1.shape[0], x1.shape[1], x1.shape[2]*x1.shape[3])
x3, get_dx2 = self.linears[-1].begin_update(x2)
def finish_update(dx3, sgd=None):
dx2 = get_dx2(dx3, sgd=sgd)
After Change
nB, nL, nD, nH = x0.shape[0], x0.shape[1], self.nD, self.nH
q0, get_dx0 = self.get_queries.begin_update(x0)
q1 = q0.reshape(nB, -1, self.nH, self.nD)
k0, get_dy0_1 = self.get_keys.begin_update(y0)
k1 = k0.reshape(nB, -1, self.nH, self.nD)
v0, get_dy0_2 = self.get_values.begin_update(y0)
v1 = v0.reshape(nB, -1, self.nH, self.nD)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: explosion/thinc
Commit Name: 8701128a21b2460583687d7ac77fc5bf3fb65356
Time: 2019-06-03
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: 8701128a21b2460583687d7ac77fc5bf3fb65356
Time: 2019-06-03
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: 8b79f460070e04e09ef799bd37c282946715cca7
Time: 2019-06-03
Author: honnibal+gh@gmail.com
File Name: thinc/neural/_classes/multiheaded_attention.py
Class Name: MultiHeadedAttention
Method Name: begin_update