MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS / _split_heads

Method _split_heads

models/modeling_moss.py:92–95  ·  view source on GitHub ↗
(self, x, n_head, dim_head, mp_num)

Source from the content-addressed store, hash-verified

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 """

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected