MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / n_embd_r

Method n_embd_r

src/llama-hparams.cpp:155–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155uint32_t llama_hparams::n_embd_r() const {
156 if (dsv4_state_size != 0) {
157 return dsv4_state_size;
158 }
159
160 if (wkv_head_size != 0) {
161 // for RWKV models
162 return token_shift_count * n_embd;
163 }
164
165 if (n_shortconv_l_cache != 0) {
166 // for LFM2 models
167 return n_embd * (n_shortconv_l_cache - 1);
168 }
169
170 if (n_embd_head_kda != 0) {
171 // for Kimi KDA layers
172 // Conv state for Q, K, V: 3 * (d_conv - 1) * n_head * head_dim
173 const uint32_t d_inner = n_head() * n_embd_head_kda; // 32 * 128 = 4096
174 return 3 * (ssm_d_conv > 0 ? ssm_d_conv - 1 : 3) * d_inner;
175 }
176
177 // TODO: maybe support other convolution strides than 1
178 // NOTE: since the first column of the conv_state is shifted out each time, it's not actually needed
179 // Corresponds to Mamba's conv_states size
180 return (ssm_d_conv > 0 ? ssm_d_conv - 1 : 0) * (ssm_d_inner + 2*ssm_n_group*ssm_d_state);
181}
182
183uint32_t llama_hparams::n_embd_s() const {
184 if (dsv4_state_size != 0) {

Callers 15

state_write_dataMethod · 0.80
state_read_dataMethod · 0.80
llm_build_kimi_linearMethod · 0.80
build_mamba_layerMethod · 0.80
build_mamba2_layerMethod · 0.80
llm_build_deepseek4Method · 0.80
llm_build_rwkv6qwen2Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected