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.

How can I do numpy advanced indexing in chainer?

See original GitHub issue

I mean how to do things like this

>>> import numpy as np
>>> a = np.array([1, 2, 3, 4])
>>> b = np.array([True, False, False, True])
>>> c = np.array([2, 0, 1, 3])
>>> a[b]
array([1, 4])
>>> a[c]
array([3, 1, 2, 4])

I have tried F.get_item but the slices parameter was limited to be

int, slice, None or Ellipsis or tuple of them

not np.narray.

So how can I do this?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yuyu2172commented, Mar 1, 2017

You are right. __getitem__ does not support += operation.

I would send a PR that supports += in the near future. Thanks.

0reactions
stale[bot]commented, Nov 22, 2017

This issue is closed as announced. Feel free to re-open it if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

chainerx.ndarray — Chainer 7.8.0 documentation
This class works similar to numpy.ndarray , except for some differences including the ... Currently, only basic indexing is supported not advanced indexing....
Read more >
Advanced NumPy Array Indexing, Made Easy | by Andre Ye
To access a range of elements, specify the start index and the stop index. The result will include all elements up to stop...
Read more >
python - numpy advanced indexing on multidimensional-array
Say x is a 3x3 numpy array that contains the following: import numpy as np x = np.array([[ 1., 2., ...
Read more >
Indexing on ndarrays — NumPy v1.25.dev0 Manual
ndarrays can be indexed using the standard Python x[obj] syntax, where x is the array and obj the selection. There are different kinds...
Read more >
Advanced indexing (numpy) not supported · Issue #711 - GitHub
It seems you want to fill 0 by boolean indexing. You can use copyto to do that. I found that the current implementation...
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