Token embeddings:
tensor([[[1., 0., 1., 0.],
         [1., 0., 1., 0.],
         [1., 0., 1., 0.]]])

Positional encodings:
tensor([[[ 0.000,  1.000,  0.000,  1.000],
         [ 0.841,  0.540,  0.010,  1.000],
         [ 0.909, -0.416,  0.020,  1.000]]])

========== Without positional encoding ==========
Q:
tensor([[1., 0., 1., 0.],
        [1., 0., 1., 0.],
        [1., 0., 1., 0.]])
Attention scores:
tensor([[1., 1., 1.],
        [1., 1., 1.],
        [1., 1., 1.]])
Attention weights:
tensor([[0.333, 0.333, 0.333],
        [0.333, 0.333, 0.333],
        [0.333, 0.333, 0.333]])
Context:
tensor([[1., 0., 1., 0.],
        [1., 0., 1., 0.],
        [1., 0., 1., 0.]])

========== With positional encoding ==========
Q:
tensor([[ 1.000,  1.000,  1.000,  1.000],
        [ 1.841,  0.540,  1.010,  1.000],
        [ 1.909, -0.416,  1.020,  1.000]])
Attention scores:
tensor([[2.000, 2.196, 1.756],
        [2.196, 2.851, 2.661],
        [1.756, 2.661, 2.929]])
Attention weights:
tensor([[0.333, 0.405, 0.261],
        [0.221, 0.426, 0.352],
        [0.149, 0.369, 0.482]])
Context:
tensor([[1.579, 0.444, 1.009, 1.000],
        [1.679, 0.305, 1.011, 1.000],
        [1.749, 0.148, 1.013, 1.000]])

Maximum attention-weight difference:
0.18409395217895508
