-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Description
import arrayfire
a = arrayfire.randu(3)
b = arrayfire.constant(1,3,dtype=arrayfire.Dtype.b8)
a[b] = 1
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-64b55ef890aa> in <module>()
----> 1 a[b] = 1
/Users/filipe/Library/Python/2.7/lib/python/site-packages/arrayfire-3.0.0-py2.7.egg/arrayfire/array.pyc in __setitem__(self, key, val)
908
909 except RuntimeError as e:
--> 910 raise IndexError(str(e))
911
912 def to_ctype(self, row_major=False, return_shape=False):
IndexError: ('In function /Users/filipe/src/arrayfire/src/api/c/assign.cpp(272):\nInvalid argument at index 3\nExpected: (idxType!=b8 )\n', 202)This works in C++, but not in C, that's why the error. I think it would be more user friendly if it worked also in C.
Here's the C++ example showing the issue in arrayfire:
#include <arrayfire.h>
int main(){
af::array a = af::randu(3);
af::array idx = af::constant(1,3,b8);
af_print(a(idx));
af_index_t c_idx;
c_idx.idx.arr = idx.get();
c_idx.isSeq = false;
c_idx.isBatch = false;
af_array ret;
af_err err = af_index_gen(&ret, a.get(), 1, &c_idx);
char * str;
dim_t strlen;
af_get_last_error(&str, &strlen);
printf("%s\n", str);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels