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

Name check on pt.tensor is too strict #1102

Open
jessegrabowski opened this issue Nov 22, 2024 · 0 comments
Open

Name check on pt.tensor is too strict #1102

jessegrabowski opened this issue Nov 22, 2024 · 0 comments
Labels
beginner friendly bug Something isn't working

Comments

@jessegrabowski
Copy link
Member

Description

a0 = pt.tensor(name="a0", dtype=floatX, shape=(m,))

Fails with the following error:

    a0 = pt.tensor(name="a0", dtype=floatX, shape=(m,))
/home/jesse/mambaforge/envs/pymc-statespace/lib/python3.11/site-packages/pytensor/tensor/type.py:791: in tensor
    raise ValueError(
E   ValueError: The first and only positional argument of tensor is now `name`. Got a0.
E   This name looks like a dtype, which you should pass as a keyword argument only.

There is a check here in pt.tensor that makes sure we're not passing a dtype as the only argument to pt.vector (for historical reasons I guess?). This is fine, but it shouldn't occur if the dtype is also specified. Fixing this would be as easy as changing the if condition to if name is not None and dtype is not None, since in that case I clearly did not want a0 interpreted as a dtype.

@jessegrabowski jessegrabowski added bug Something isn't working beginner friendly labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner friendly bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant