question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Array analysis error for constant float tuple creation

See original GitHub issue

Reporting a bug

Minimal example:

import numba

@numba.njit(parallel=True)
def f():
    a = (1.2, 1.3)
    return a[0]

f()
  File "/Users/ehsan/dev/numba/numba/parfors/parfor.py", line 2708, in run
    self._pre_run()
  File "/Users/ehsan/dev/numba/numba/parfors/parfor.py", line 2700, in _pre_run
    self.array_analysis.run(self.func_ir.blocks)
  File "/Users/ehsan/dev/numba/numba/parfors/array_analysis.py", line 1119, in run
    self._run_on_blocks(topo_order, blocks, cfg, init_equiv_set)
  File "/Users/ehsan/dev/numba/numba/parfors/array_analysis.py", line 1139, in _run_on_blocks
    pending_transforms = self._determine_transform(
  File "/Users/ehsan/dev/numba/numba/parfors/array_analysis.py", line 1220, in _determine_transform
    pre, post = self._analyze_inst(
  File "/Users/ehsan/dev/numba/numba/parfors/array_analysis.py", line 1337, in _analyze_inst
    needs_define = equiv_set.insert_equiv(lhs, shape)
  File "/Users/ehsan/dev/numba/numba/parfors/array_analysis.py", line 518, in insert_equiv
    obj_names = [self._get_names(x) for x in objs]
  File "/Users/ehsan/dev/numba/numba/parfors/array_analysis.py", line 518, in <listcomp>
    obj_names = [self._get_names(x) for x in objs]
  File "/Users/ehsan/dev/numba/numba/parfors/array_analysis.py", line 431, in _get_names
    raise NotImplementedError(
NotImplementedError: Failed in nopython mode pipeline (step: convert to parfors)
ShapeEquivSet does not support 1.2

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
njriasancommented, Jan 3, 2022

whether equivalence across inexact types is desirable or useful is another matter?

I spoke to @ehsantn regarding this. I can’t speak to other possible usage, but our concern is simply that it doesn’t compile and not that we need to track tuples of floats. @stuartarchibald I assume this has been deprioritized, so I will make sure someone from Bodo picks up this issue.

0reactions
stuartarchibaldcommented, Nov 16, 2020

@DrTodd13

It will make the error go away perhaps but why would we ever need to track tuples of floats for the purpose of determining if two array dimensions are equivalent?

Quite 😃 This is why I was considering whether this is useful or desirable, couldn’t come up with a use case for it but wasn’t sure if I was missing something.

We just wouldn’t form a shape equiv entry for non-int parts of tuples and also wouldn’t throw an error either. Does that make sense? Do you want to take a stab or you want me to still look into it?

This makes sense if there’s no conditions that exist for it. I think ShapeEquivSet._get_names needs to return () in such cases, I can take a look. Thanks for the input.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I am try to assigne float numbers from tuple to numpy array
Looks like your numpy array is not of a float type. This means that your array can store only integers in this example....
Read more >
Chapter 4. NumPy Basics: Arrays and Vectorized Computation
In complex computations, you may accrue some floating point error, making comparisons only valid up to a certain number of decimal places. Operations...
Read more >
8. Lists and Tuples - Art of Problem Solving
Once Python has created a tuple in memory, it cannot be changed. ... The following list contains a string, a float, an integer,...
Read more >
typing — Support for type hints — Python 3.11.1 documentation
T = TypeVar('T', int, float, complex) Vec = Iterable[tuple[T, ... For example, the static type checker did not report an error when assigning...
Read more >
Supported Python features - Numba
It is currently unsupported to re-raise an exception created in compiled code. ... can only be used on tuples and constant lists of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found