Repository navigation
selfAttention selfAttention
GitHub Action edited this page Jul 9, 2026
·
1 revision
selfAttention(size_t n_embd)Initializes a self attention block with three square weight matrices following the passed n_embd dimensions.
Applies self attention.
| Variable | Type |
|---|---|
wq |
utility::matrix |
wk |
utility::matrix |
wv |
utility::matrix |
q |
utility::matrix |
k |
utility::matrix |
v |
utility::matrix |
p |
utility::matrix |
x |
utility::matrix |
n_tok |
size_t |
n_embd |
size_t |
generator |
std::default_random_engine |
initDist |
std::normal_distribution<float> |
// Initializing a self attention block
selfAttention a(91);- AIUsage
- Block
- Embedder
- Introduction
- Layer
- Model
- NeuralNetwork
- PositionalEncoding
- SelfAttention
- Tokenizer
- Utility