Skip to content

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

@michaelosthege

Description

@michaelosthege

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions