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

Splatting does not work (with non-linear node) #122

Closed
bartvanerp opened this issue May 30, 2023 · 3 comments · Fixed by #272
Closed

Splatting does not work (with non-linear node) #122

bartvanerp opened this issue May 30, 2023 · 3 comments · Fixed by #272
Assignees
Labels
bug Something isn't working

Comments

@bartvanerp
Copy link
Member

The following code excerpt fails:

function foo(x...)
    return sum(x)
end

@model function model_test()
    z = randomvar(10)
    for k in 1:10
        z[k] ~ NormalMeanVariance(0.0, 1.0)
    end
    x ~ foo(z...)
    y = datavar(Float64)
    y ~ NormalMeanVariance(x, 1.0)
    
end

with error MethodError: no method matching as_variable(::FactorGraphModel, ::RandomVariable, ::RandomVariable, ::RandomVariable, ::RandomVariable, ::RandomVariable, ::RandomVariable, ::RandomVariable, ::RandomVariable, ::RandomVariable, ::RandomVariable).

It likely has to do with the splat operator, possibly in combination with the non-linear node.
This functionality is very useful for dealing with multiple random variables going into a non-linear node. This prevents us from having to write foo(z[1], z[2], ....), which is not automatable when the number is a hyperparameter.

@bartvanerp bartvanerp added the bug Something isn't working label May 30, 2023
@bartvanerp bartvanerp changed the title Splatting does not nicely work (with non-linear node) Splatting does not work (with non-linear node) May 30, 2023
@albertpod albertpod self-assigned this Jun 1, 2023
@wouterwln
Copy link
Member

Should also be fixed in graphppl 4.0 but I'll close this myself after we merge everything and I've checked.

@albertpod
Copy link
Member

@wouterwln why is this issue closed? This doesn't seem working in RxInfer.jl

@wouterwln
Copy link
Member

Ah, it is fixed in the new GraphPPL release, we should probably reopen until it is fully merged

@albertpod albertpod reopened this Jan 3, 2024
@wouterwln wouterwln added this to the RxInfer 3.0.0 release milestone Mar 15, 2024
@wouterwln wouterwln linked a pull request Apr 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants