Skip to content

Commit 987b420

Browse files
committed
add tests softmax
1 parent ef7decf commit 987b420

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/layers/softmax_tests.jl

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@testitem "Softmax" begin
2+
3+
using UnboundedBNN: Softmax
4+
using StatsFuns: softmax
5+
6+
A = randn(100, 200)
7+
layer = Softmax(200)
8+
@test all(exp.(layer(A)) .≈ softmax(A, dims = 1))
9+
10+
@test sum(exp, layer(randn(1000))) 1.0
11+
@test sum(exp, layer(randn(1000, 100))) 100.0
12+
13+
@test all(layer(A, zeros(size(A)))[1] .≈ layer(A))
14+
@test layer(A, zeros(size(A)))[2] === nothing
15+
16+
end

0 commit comments

Comments
 (0)