Skip to content

Commit 91d42a9

Browse files
author
cossio
committed
unsqueeze tests
1 parent db90581 commit 91d42a9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/utils.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
using Flux
22
using Flux: throttle, nfan, glorot_uniform, glorot_normal,
33
kaiming_normal, kaiming_uniform, orthogonal,
4-
sparse_init, stack, unstack, Zeros, batch, unbatch
4+
sparse_init, stack, unstack, Zeros, batch, unbatch,
5+
unsqueeze
56
using StatsBase: var, std
67
using Random
78
using Test
89

10+
@testset "unsqueeze" begin
11+
x = randn(2, 3, 2)
12+
@test unsqueeze(x, 1) == reshape(x, 1, 2, 3, 2)
13+
@test unsqueeze(x, 2) == reshape(x, 2, 1, 3, 2)
14+
@test unsqueeze(x, 3) == reshape(x, 2, 3, 1, 2)
15+
@test unsqueeze(x, 4) == reshape(x, 2, 3, 2, 1)
16+
end
17+
918
@testset "Throttle" begin
1019
@testset "default behaviour" begin
1120
a = []

0 commit comments

Comments
 (0)