Skip to content

Do not force lower precision in intX #4553

Open
@ferrine

Description

@ferrine

Description of your problem

Please provide a minimal, self-contained, and reproducible example.
See implementation here
https://github.com/pymc-devs/pymc3/blob/c1efb7ad51e34e6bd8b292ef226a7e191adbdb82/pymc3/theanof.py#L92
for float32 precision, it converts values to int16
for float64 precision, it converts values to int32
But the implementation of Binomial distributions
https://github.com/pymc-devs/pymc3/blob/c1efb7ad51e34e6bd8b292ef226a7e191adbdb82/pymc3/distributions/multivariate.py#L714
https://github.com/pymc-devs/pymc3/blob/c1efb7ad51e34e6bd8b292ef226a7e191adbdb82/pymc3/distributions/discrete.py#L103
Does not assume a float is converted to int, thus converting ints in this way may overflow (I ran exactly into this issue)

Please provide the full traceback.
The referenced code is enough to spot the problem

Please provide any additional information below.
The issue is also relevant to pymc v4

Versions and main components

  • PyMC3 Version: 3.11.2
  • Aesara Version: None
  • Python Version: 3.8.9
  • Operating system: Archlinux
  • How did you install PyMC3: pip

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