Skip to content

Commit

Permalink
Merge pull request #100 from DrChainsaw/compathelper/new_version/2024…
Browse files Browse the repository at this point in the history
…-12-16-00-59-29-487-04272993560

CompatHelper: bump compat for Flux to 0.16, (keep existing compat)
  • Loading branch information
DrChainsaw authored Mar 2, 2025
2 parents a7e3285 + 04afeb9 commit 15b5895
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
ChainRulesCore = "1"
Flux = "0.15.2"
Flux = "0.15.2, 0.16"
Functors = "0.4, 0.5"
JuMP = "0.21, 0.22, 0.23, 1"
NaiveNASflux = "2.0.10"
Expand Down
21 changes: 13 additions & 8 deletions test/deserialize/constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@testset "Reshape" begin
using ONNXNaiveNASflux: Reshape
using ONNXNaiveNASflux.NaiveNASlib.Advanced

rv(name, invertex, dims) = absorbvertex(name, MeasureNout(Reshape(dims)), invertex; traitdecoration=SizePseudoTransparent)

Expand All @@ -27,7 +28,7 @@

@test size(g(ones(Float32, 3, 15))) == (5,2,4,2)

@test_logs (:warn, r"Could not change nout") Δnout!(v1, 3)
@test_logs (:warn, r"Could not change nout") Δnout!(Returns(1), v1, 3)

@test nout.(vertices(g)) == [3, 6, 3, 4]
@test size(g(ones(Float32, 3, 15))) == (5,2,4,3)
Expand All @@ -46,7 +47,7 @@

@test size(g(ones(Float32, 3, 15))) == (5,2,4,2)

@test_logs (:warn, r"Could not change nout") Δnout!(v1, 3)
@test_logs (:warn, r"Could not change nout") Δnout!(Returns(1), v1, 3)

@test nout.(vertices(g)) == [3, 6, 3, 4]
@test size(g(ones(Float32, 3, 15))) == (5,3,4,2)
Expand All @@ -67,7 +68,7 @@

# note that this works only because MeasureNout got the size when we evaluated the graph absorbvertex
# In other cases one might need try_infer_sizes!
@test_logs (:warn, r"Could not change nout") Δnout!(v1, 3)
@test_logs (:warn, r"Could not change nout") Δnout!(Returns(1), v1, 3)

@test nout.(vertices(g)) == [3, 6, 3, 4]
@test size(g(ones(Float32, 3, 15))) == (5,3,4,2)
Expand All @@ -88,7 +89,7 @@

# note that this works only because MeasureNout got the size when we evaluated the graph absorbvertex
# In other cases one might need try_infer_sizes!
@test_logs (:warn, r"Could not change nout") Δnout!(v1, 3)
@test_logs (:warn, r"Could not change nout") Δnout!(Returns(1), v1, 3)

@test nout.(vertices(g)) == [3, 30, 3, 4]
@test size(g(ones(Float32, 3, 2))) == (2,5,4,2)
Expand All @@ -107,7 +108,7 @@

@test size(g(ones(Float32, 3, 15))) == (5,2,4,2)

@test @test_logs((:warn, r"Could not change nout"), match_mode=:any, Δnout!(v1, 3)) == false
@test @test_logs((:warn, r"Could not change nout"), match_mode=:any, Δnout!(Returns(1), v1, 3)) == false

@test nout.(vertices(g)) == [3, 4, 3, 4]
@test size(g(ones(Float32, 3, 15))) == (5,2,4,2)
Expand All @@ -123,12 +124,16 @@
@test layer(v2) isa Reshape

g = CompGraph(v0, v3)
startsizes = nout.(vertices(g))

@test size(g(ones(Float32, 3, 20))) == (5,2,4,2)

@test_logs (:warn, r"Could not change nout") Δnout!(v1, 3)
# Must change by an even number, so this can't work
@test !Δsize!(Returns(1), ΔNoutExact(v1 => 3; fallback = ΔSizeFailNoOp()))
@test Δnout!(v1, 2)

@test nout.(vertices(g)) == [3, 6, 6, 4]

@test size(g(ones(Float32, 3, 20))) == (5,2,4,2)
end

Expand All @@ -145,7 +150,7 @@

@test size(g(ones(Float32, 5,2,3,2))) == (4, 16)

@test_logs (:warn, r"Could not change nout") Δnout!(v1, 3)
@test_logs (:warn, r"Could not change nout") Δnout!(Returns(1), v1, 3)

@test nout.(vertices(g)) == [3, 8, 10, 4]
@test size(g(ones(Float32, 5,2,3,2))) == (4, 16)
Expand All @@ -164,7 +169,7 @@

@test size(g(ones(Float32, 5,2,3,2))) == (4, 16)

@test_logs (:warn, r"Could not change nout") Δnout!(v1, 3)
@test_logs (:warn, r"Could not change nout") Δnout!(Returns(1), v1, 3)

@test nout.(vertices(g)) == [3, 16, 20, 4]
@test size(g(ones(Float32, 5,2,3,2))) == (4, 16)
Expand Down
1 change: 0 additions & 1 deletion test/serialize/serialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,6 @@
@testset "Inputshape $s" for s in testsizes
assertwarn = s isa Tuple && length(s) != length(shape(layertype(op), 1))
g = remodel(op, s; assertwarn)
Flux.reset!(op) # For RNNs or else the test below will fail
@test g(inpt) == op(inpt)
end
end
Expand Down

0 comments on commit 15b5895

Please sign in to comment.