Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select outputs after creating an edge to size stack at position other than last fails #59

Open
DrChainsaw opened this issue Oct 26, 2019 · 1 comment

Comments

@DrChainsaw
Copy link
Owner

Root cause is that variable array for selecting existing outputs can only select from previous existing outputs.

The logic to deal with this in inoutconstraint!(s, ::SizeStack, v, model, vardict::Dict) assumes that any misaligned inputs are last in inputs(v).

It might be possible to avoid aligning select vars but do align insertion vars as they can be assumed to have the same size. MWE below fails to align sizes and reverts the edge addition when this change is made though.

MWE testset which runs in select.jl:

    @testset "Create edge to SizeStack pos 1" begin
        inpt = iv(3)
        v1 = av(inpt, 2, "v1")
        v2 = av(inpt, 3, "v2")
        v3 = cc(v1, name="v3")
        v4 = av(v3, 3, "v4")

        g = CompGraph(inpt, v3)
        @test size(g(ones(Float32, 1,3))) == (1, nout(v3))

        create_edge!(v2, v3, pos=1)
        Δoutputs(v3, v -> 1:nout_org(v))

        @test in_inds(op(v4)) == [-1,-1,-1,1,2]

        @test size(g(ones(Float32, 1,3))) == (1, nout(v3))
    end
@DrChainsaw
Copy link
Owner Author

Testcase for structure (where it belongs):

@testset "Create edge to SizeStack pos 1" begin
    v0 = inpt(3, "v0")
    v1 = av(v0, 2; name="v1")
    v2 = av(v0, 3, name="v2")
    v3 = conc(v1; dims=2, traitdecoration=tf("v3"))
    v4 = av(v3, 3, name="v4")

    g = CompGraph(v0, v3)
    @test size(g(ones(3))) == (nout(v3),1)

    @test create_edge!(v2, v3, pos=1)

    @test lastins(v4) == [-1,-1,-1,1,2]

    @test size(g(ones(3))) == (nout(v3),1)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant