Comments (3)
Consider me intrigued...
Sounds like somewhere there is a conversion to float64, because that exact number is one bigger than the largest integer a float64 can represent exactly:
np.float64(9223372036854775).astype(np.int64)
is our magic 9223372036854776
.
from pytensor.
This seems to have been around for a long time.
The maximum and minimum are implemented as CAReduction (pytensor.scalar.basic.ScalarMaximum
). There seem to be two problems with this implementation: Both scalar Ops specify inf
and -inf
as identity element, but if we are working with integer types, those do not even have an identity.
But the direct source of the bug seems to be this generated C-Code:
return f"{z} = (({y})>({x})? ({y}): " f'(({x})>=({y})? ({x}): nan("")));'
It tries to ignore nans, but by doing so it implicitly converts the intermediate values to floats.
I guess it might make sense to split the ScalarOps: One for floats (where we have an identity) and one for ints (where we don't). And then use the nan-check only for floats.
edit
This was introduced here: aesara-devs/aesara#297
from pytensor.
The conversion story makes sense. Regarding infty, the code actually initializes those to zero when it's (u)integers.
The number thing was not a hard cutoff. It starts working with larger values and then fails again. In case that helps.
And yes this bug is likely there for a while but was hidden when the max/min could be constant folded, triggering the C implementation of MaxAndArgmax instead which just calls numpy C code and handles it correctly.
from pytensor.
Related Issues (20)
- Vectorize node should return list of variables not node
- Mention and test inputs can be > 1D in hessian_vector_prod
- Reconsider min implementation as negative of max
- New betainc C implementation less precise than Scipy
- Reorganize `tensor.basic.py` and `tensor.math.py`. HOT 2
- DimShuffle should be happy to drop dims if they have length 1 at runtime
- Consider lifting Subtensor through Joins
- ENH: Default `steps` in `linspace` HOT 4
- Reductions along leading axes can be incredibly slow in C and Numba backends HOT 2
- Testing Shared Variables in torch
- Adding conditionals for torch HOT 3
- Extend inverse @ b as solve rewrite to batched dots
- Do we need dot Op to handle the vector cases?
- BUG: Unable to install pytensor as a package with pip install -e HOT 11
- ENH: Native support for dims in tensors and tensor operations HOT 7
- Delete `extra_ops.py`, replace with specialized files with more informative names
- Use contraction path to optimize `pt.nlinalg.matrix_dot`
- DOC: Fix Typographical Error in Contributing Guidelines HOT 2
- Bug in gradient of fft.rfft
- Simplify elemwise? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytensor.