|
190 | 190 | m = @autosize (2, 3, 4, 5) Dense(_ => 10) # goes by first dim, not 2nd-last |
191 | 191 | @test randn(2, 3, 4, 5) |> m |> size == (10, 3, 4, 5) |
192 | 192 |
|
193 | | - @test_broken begin # outputsize fails on Embedding |
194 | | - m = @autosize (2, 3, 4, 5) Embedding(_ => 10) # goes by first dim, not 2nd-last |
195 | | - @test randn(2, 3, 4, 5) |> m |> size == (10, 3, 4, 5) |
196 | | - end |
197 | | - |
198 | 193 | m = @autosize (9,) Dense(_ => div(_,2)) |
199 | 194 | @test randn(9) |> m |> size == (4,) |
200 | 195 |
|
|
249 | 244 | # https://github.com/FluxML/Flux.jl/issues/2086 |
250 | 245 | m = @autosize (3, 1) Chain(; c = Dense(_ => 2, sigmoid), b = BatchNorm(_, affine=false)) |
251 | 246 | @test randn(Float32, 3, 32) |> m |> size == (2, 32) |
| 247 | + |
| 248 | + # Embedding takes a vocab size, not an array size |
| 249 | + @test_throws ErrorException @autosize (2, 3) Embedding(_ => 10) |
| 250 | + m = @autosize (3,) Chain(Embedding(26 => 10), Dense(_, 4)) |
| 251 | + @test rand(1:26, 3) |> m |> size == (4, 3) |
252 | 252 | end |
253 | 253 |
|
254 | 254 | @testset "LazyLayer" begin |
|
0 commit comments