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

BUG: pt.stack inputs type hint is incomplete #193

Closed
michaelosthege opened this issue Jan 12, 2023 · 3 comments
Closed

BUG: pt.stack inputs type hint is incomplete #193

michaelosthege opened this issue Jan 12, 2023 · 3 comments
Labels
beginner friendly bug Something isn't working

Comments

@michaelosthege
Copy link
Member

Describe the issue:

The function also accepts non-symbolic scalar types such as np.number, float, int, builtins.complex as well as scalar Variables, but it's advertised as Sequence[TensorVariable].

Reproducable code example:

pt.stack([1, 2])  # works

Error message:

mypy reports things like

error: Argument 1 to "stack" has incompatible type "Sequence[Union[int, ndarray[Any, Any], Variable[Any, Any]]]"; expected "Sequence[TensorVariable[Any, Any]]"

PyTensor version information:

2.9.1

Context for the issue:

Detected by mypy job in https://github.com/pymc-devs/pymc/actions/runs/3903049911/jobs/6666888669 from pymc-devs/pymc#6431

@michaelosthege michaelosthege added the bug Something isn't working label Jan 12, 2023
michaelosthege added a commit to michaelosthege/pymc that referenced this issue Jan 12, 2023
twiecki pushed a commit to pymc-devs/pymc that referenced this issue Jan 12, 2023
* Bump PyTensor to 2.9.1

* Allow installation from `.conda` artifacts

* Workaround type issues in `shape_utils`

Caused by pymc-devs/pytensor#193
@covertg
Copy link
Contributor

covertg commented Jan 31, 2023

Would the preferred solution just be to update the input type to a Union of scalar and array types?

I suppose that a similar issue might exist for many pytensor functions that work with any of: Variable, scalar, and numpy types?

@michaelosthege
Copy link
Member Author

yes, that's pretty much it

covertg added a commit to covertg/pytensor that referenced this issue Feb 3, 2023
@covertg covertg mentioned this issue Feb 3, 2023
6 tasks
@michaelosthege
Copy link
Member Author

Closed by #205

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

2 participants