Comments (3)
The float()
built-in is not currently handled by the compiler, and we don't currently have code to cleanly identify when a built-in function is not supported.
Numba does handle implicit casts, however. You should only have to say result[i] += avg / N
, and Numba should cast N
to a floating-point value.
I can't currently speak to the segmentation fault, but I'll definitely add a test case and see if I can reproduce all of this.
from numba.
Related to this: I've run in several problems when working with number literals. I've got problems when trying to generate code for functions that do literals. For example, the following function works fine when generating code with d[:], d[:] input and output, but will fail with f[:], f[:] ones.
def twice(X, D):
M = X.shape[0]
for i in range(M):
D[i] = 2.0 * X[i]
ValueError: Unsupported cast (from <Variable(val=<llvm.core.Instruction object at 0x10984aa50>, _llvm=<llvm.core.Instruction object at 0x10984aa50>, typ='f32')>.typ to 'f64')
Note that this does not happen if I use 2 instead of 2.0.
Something similar happens with the following function:
def pow2(X,D):
M = X.shape[X]
for i in range(M):
D[i] = X[i] ** 2
No matter what combination of input types I try to use, code-generation fails with an "Unsupported Cast".
from numba.
This issue has been fixed for some time now, so I'm closing it.
from numba.
Related Issues (20)
- np.median raises AssertionError for empty arrays while numpy returns nan HOT 1
- Integrate ZLUDA for AMD CUDA HOT 3
- `nextafter` (via both `math` and `numpy`) missing for CUDA
- Fill out `python -m numba -s` field for `CUDA Libraries Test Output` (even if GPU is absent) HOT 1
- Overloaded function is compiled more than once with the same signature HOT 4
- Regression: searchsorted drastically slower in tight loops HOT 3
- test_sum1d_pyobj crashes on aarch64-linux on 0.59.0 HOT 5
- `AttributeError` for inlined generic functions with py312 pep-695 type-parameter syntax HOT 5
- [numba.cuda] StructModel + FP16 fails with CUDA because make_attribute_wrapper assumes default_manager HOT 1
- No matching implimentation for `np.empty` in guvectorized function with `NUMBA_DISABLE_JIT=1` and related caching issue HOT 4
- Casting error HOT 3
- overload_methoded function shouldn't set `no_cpython_wrapper` as `False` HOT 4
- How about unifying `int32` and `Literal[int](0)` as `int32`, rather than `int64` HOT 2
- The `np.size()` Function Fails HOT 1
- I get super bad performance when using zip() and parallel=True HOT 3
- CUDA target respect NUMBA_OPT environment variable HOT 4
- CUDA crashes when passed complex record array HOT 12
- [ANN] Numba User Survey 2024 HOT 1
- want `int64` rather than `Optional(int64)` when `dict.get(key, default_int64)` and dict value type is `int64` HOT 1
- Infer Numba Types from Python Type Hints HOT 3
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 numba.