Minor cleanup

This commit is contained in:
aegkmq
2023-07-26 16:38:42 +09:00
parent 36c522a0d8
commit 8986005f23
+3 -3
View File
@@ -281,10 +281,10 @@ void transformer(int token, int pos, Config* p, RunState* s, TransformerWeights*
// weighted sum of the values, store back into xb // weighted sum of the values, store back into xb
float* xb = s->xb + h * head_size; float* xb = s->xb + h * head_size;
memset(xb, 0, head_size * sizeof(float)); memset(xb, 0, head_size * sizeof(float));
for (int t = 0; t <= pos; t += 1) { for (int t = 0; t <= pos; t++) {
float* v = s->value_cache + loff + t * dim + h * head_size; float* v = s->value_cache + loff + t * dim + h * head_size;
float a = s->att[h * p->seq_len + t]; float a = att[t];
for (int i = 0; i < head_size; i += 1) { for (int i = 0; i < head_size; i++) {
xb[i] += a * v[i]; xb[i] += a * v[i];
} }
} }