11using Test, Random, Flux
22
33@testset " FourierLayer" begin
4- # Test the proper construction
5- @test size (FourierLayer (128 , 64 , 100 , 20 ). Wf) == (128 , 64 , 51 )
6- @test size (FourierLayer (128 , 64 , 100 , 20 ). Wl) == (64 , 128 )
7- # @test size(FourierLayer(10, 100).bias_f) == (51,)
8- # @test size(FourierLayer(10, 100).bias_l) == (100,)
4+ @testset " dimensions" begin
5+ # Test the proper construction
6+ @test size (FourierLayer (128 , 64 , 100 , 20 ). Wf) == (128 , 64 , 51 )
7+ @test size (FourierLayer (128 , 64 , 100 , 20 ). Wl) == (64 , 128 )
8+ @test size (FourierLayer (128 , 64 , 100 , 20 ). bf) == (1 , 64 , 51 )
9+ @test size (FourierLayer (128 , 64 , 100 , 20 ). bl) == (1 , 64 , 100 )
10+ end
11+
12+ # Test proper parameter assignment
13+ # We only use a subset of the weight tensors for training
14+ @testset " parameters" begin
15+ # Wf
16+ @test size (params (FourierLayer (128 , 64 , 100 , 20 ))[1 ]) == (128 , 64 , 20 )
17+ # Wl
18+ @test size (params (FourierLayer (128 , 64 , 100 , 20 ))[2 ]) == (128 , 64 , 20 )
19+ # bf
20+ @test size (params (FourierLayer (128 , 64 , 100 , 20 ))[3 ]) == (1 , 64 , 20 )
21+ # bl
22+ @test size (params (FourierLayer (128 , 64 , 100 , 20 ))[4 ]) == (1 , 64 , 100 )
23+ end
924
1025 # Accept only Int as architecture parameters
1126 @test_throws MethodError FourierLayer (128.5 , 64 , 100 , 20 )
1227 @test_throws MethodError FourierLayer (128.5 , 64 , 100 , 20 , tanh)
28+ # Test max amount of modes
1329 @test_throws AssertionError FourierLayer (100 , 100 , 100 , 60 , σ)
1430 @test_throws AssertionError FourierLayer (100 , 100 , 100 , 60 )
1531end
0 commit comments