Closed andyyankai closed 4 years ago
You will need to use mask-assignement for this. Something like this:
mask_t<FloatD> mask = {0, 1, 0, 0, ...};
arr[mask] += t;
You could also use arange
to craft some fancier masks based on indexing.
Please note that you will often find answers to such questions by reading the documentation carefully. We would like to keep github issues for actual issues/bugs with the library 😉
Trying to do this:
FloatD arr = {1.f,3.f,2.f,5.f,6.f,2.f,6.f}; FloatD t = 0.0f; set_requires_gradient(t);
arr[2] = arr[2] + t (error: lvalue required as left operand of assignment)