(self, x, n_head, dim_head, mp_num)
| 90 | self.embed_positions = create_sinusoidal_positions(max_positions, pos_embd_dim) |
| 91 | |
| 92 | def _split_heads(self, x, n_head, dim_head, mp_num): |
| 93 | reshaped = x.reshape(x.shape[:-1] + (n_head // mp_num, dim_head)) |
| 94 | reshaped = reshaped.reshape(x.shape[:-2] + (-1,) + reshaped.shape[-1:]) |
| 95 | return reshaped |
| 96 | |
| 97 | def _merge_heads(self, tensor, num_attention_heads, attn_head_size): |
| 98 | """ |