JIT invariance problem for large Python integers as arguments to function
See original GitHub issueIn [1]: import jax, jax.numpy as jnp
In [2]: jnp.multiply(2 ** 100, 3.) # doesn't crash
...:
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
Out[2]: DeviceArray(3.8029518e+30, dtype=float32)
In [3]: jax.jit(jnp.multiply)(2 ** 100, 3.)
...
OverflowError Traceback (most recent call last)
<ipython-input-3-2aed3283764c> in <module>
----> 1 jax.jit(jnp.multiply)(2 ** 100, 3.)
~/p/jax/jax/_src/dtypes.py in _scalar_type_to_dtype(typ, value)
125 if typ is int and value is not None:
126 if value < np.iinfo(dtype).min or value > np.iinfo(dtype).max:
--> 127 raise OverflowError(f"Python int {value} too large to convert to {dtype}")
128 return dtype
129
OverflowError: Python int 1267650600228229401496703205376 too large to convert to int32
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Python Numba module gives me a wrong answer when using ...
The problem is that for integer representations for numbers, there are upper and lower limits of what can be represented.
Read more >Automatic parallelization with @jit - Numba
Setting the parallel option for jit() enables a Numba transformation pass that attempts to automatically parallelize and perform other optimizations on (part of) ......
Read more >PEP 484 – Type Hints - Python Enhancement Proposals
For example, here is a simple function whose argument and return type are ... For example, the type “sequence of integers” can be...
Read more >Dr.Jit: A Just-In-Time Compiler for Differentiable Rendering
Jit executes a rendering algorithm, it generates a trace: a large graph comprised of arithmetic, loops, ray tracing operations, and polymorphic calls that ......
Read more >Release Notes — Numba 0.56.4+0.g288a38bbd.dirty-py3.7 ...
Numba imports more quickly in environments with large numbers of packages as it now uses ... List ignores ctor arguments with JIT disabled...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If we’re going to pursue plan 2, then in this case I think we can leave this issue open for now and reduce churn. This seems like a pretty low-priority JIT invariance case, with an already good error message and a pretty clear fix (manually casting the input to the desired type)
I think the issue has been fixed: