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

SPPL compiler replaces == and in with << incorrectly at times #125

Open
fsaad opened this issue Sep 7, 2022 · 0 comments
Open

SPPL compiler replaces == and in with << incorrectly at times #125

fsaad opened this issue Sep 7, 2022 · 0 comments

Comments

@fsaad
Copy link
Collaborator

fsaad commented Sep 7, 2022

MWE

>>> source = """
i = 0.5
Y ~= bernoulli(p=0 if i == 0.5 else 1)
"""
>>> compiler = SPPL_Compiler(source)
>>> namespace = compiler.execute_module()
TypeError: unsupported operand type(s) for <<: 'float' and 'set'

The reason is that the generated Python is

# MODEL DEFINITION
command = Sequence(
    Sample(Y, bernoulli(p=(0 if (i << {0.5}) else 1))),
)

The offending line is here:
https://github.com/probcomp/sppl/blob/8b0fe0c37ed15dd19936d13e0fa652c3b5237cac/src/compilers/sppl_to_python.py#L145

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