Variables | |
B | |
T | |
C | |
x = torch.randn(B, T, C) | |
xbow = torch.zeros((B, T, C)) | |
xprev = x[b, : t + 1] | |
wei = torch.tril(torch.ones(T, T)) | |
xbow2 = wei @ x | |
tril = torch.tril(torch.ones(T, T)) | |
xbow3 = wei @ x | |
int | head_size = 16 |
key = nn.Linear(C, head_size, bias=False) | |
query = nn.Linear(C, head_size, bias=False) | |
k = key(x) | |
q = query(x) | |
out = wei @ x | |
a = torch.tril(torch.ones(3, 3)) | |
b = torch.randint(0, 10, (3, 2)).float() | |
c = a @ b | |
tensor_prac.Self_Attention.a = torch.tril(torch.ones(3, 3)) |
Definition at line 75 of file Self_Attention.py.
tensor_prac.Self_Attention.B |
Definition at line 9 of file Self_Attention.py.
tensor_prac.Self_Attention.b = torch.randint(0, 10, (3, 2)).float() |
Definition at line 77 of file Self_Attention.py.
tensor_prac.Self_Attention.C |
Definition at line 9 of file Self_Attention.py.
Definition at line 79 of file Self_Attention.py.
int tensor_prac.Self_Attention.head_size = 16 |
Definition at line 57 of file Self_Attention.py.
Definition at line 60 of file Self_Attention.py.
Definition at line 58 of file Self_Attention.py.
Definition at line 67 of file Self_Attention.py.
Definition at line 61 of file Self_Attention.py.
Definition at line 59 of file Self_Attention.py.
tensor_prac.Self_Attention.T |
Definition at line 9 of file Self_Attention.py.
Definition at line 36 of file Self_Attention.py.
Definition at line 28 of file Self_Attention.py.
Definition at line 12 of file Self_Attention.py.
Definition at line 15 of file Self_Attention.py.
Definition at line 30 of file Self_Attention.py.
Definition at line 40 of file Self_Attention.py.
Definition at line 18 of file Self_Attention.py.