I am changing the code created by numpy to tensorflow code.
However, tensorflow does not support specifying each element, (eg x [i] = 7), boolean (eg.var [x <0.25] = -1) with possible array of numpy It is difficult.
How can I change the following code to tensor?
x=np.random.rand((500*300))
var=np.zeros((500*300), dtype=np.uint16)
var[x<.25] = -1
var[x>.75] = 1
S=var.reshape((500, 300))
Please, help me.
Note: I try this step.
x=tf.random_uniform((500*300), minval=0, maxval=1, dtype=tf.float32)
var=tf.zeros((500*300), int16)
var[x<.25] = -1 # How is the change???????
var[x>.75] = 1 # How is the change???????
S=var.reshape((500, 300))