Let's go straight, currently, I want to index a tensor and change the non-zero term to -1 and zero term to 1. But I don't know how to do it in TensorFlow.
Here is my code:
y_[y_ != 0].assign(-1)
y_[y_ == 0].assign(1)
The reason is TensorFlow doesn't seem to support boolean indexing. How can I fix it?
Btw, it seems boolean_mask doesn't work for me, because I don't want to return a slice of y_, I just want y_ to change its values.
Thanks!