MCPcopy Create free account
hub / github.com/Tencent/NeuralNLP-NeuralClassifier / cal_angle

Method cal_angle

model/embedding.py:231–232  ·  view source on GitHub ↗
(position, hid_idx)

Source from the content-addressed store, hash-verified

229 def get_sinusoid_encoding_table(n_position, d_hid, padding_idx=None):
230
231 def cal_angle(position, hid_idx):
232 return position / np.power(10000, 2 * (hid_idx // 2) / d_hid)
233
234 def get_posi_angle_vec(position):
235 return [cal_angle(position, hid_j) for hid_j in range(d_hid)]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected