Skip to content

Commit 10e99c7

Browse files
test bias
1 parent 19d377a commit 10e99c7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/attention.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,12 @@ end
5656
y, α = dot_product_attention(q, k, v; nheads=2, fdrop = x -> fdrop(x, 0.5))
5757
@test 0.6 > mean(>(0), α) > 0.4
5858
end
59+
60+
@testset "bias" begin
61+
q = rand(4, 5, 1)
62+
k = v = rand(4, 3, 1)
63+
bias = randn(3, 5)
64+
y, α = dot_product_attention(q, k, v, bias; nheads=2)
65+
@test size(α) == (3, 5, 2, 1)
66+
@test size(y) == (4, 5, 1)
67+
end

0 commit comments

Comments
 (0)