Skip to content

BUG: <uint64 dtype is broken for Max> #770

Open
@Dhruvanshu-Joshi

Description

@Dhruvanshu-Joshi

Describe the issue:

The Max op which is a subclass of CAReduce fails for 64 bit unsigned integers. This is also evident in the PR 731 and its test. The exact number where uint64 starts failing for is 9223372036854775.
Error can also be reproduced with the following example:

Reproducable code example:

import pytensor.tensor as pt
import numpy as np

dtype="uint64"
n = pt.vector("n", shape=(None,), dtype=dtype)
test_n = np.array([0, 9223372036854775], dtype)

assert pt.max(n).dtype == dtype
print(pt.max(n).eval({n: test_n})) # 9223372036854776
print(test_n.max()) # 9223372036854775
assert pt.max(n).eval({n: test_n}) == test_n.max()  # Fails, returns 1 larger

Error message:

No response

PyTensor version information:

Python 3.11.8
Pytensor 2.20.0

Context for the issue:

No response

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