I am new to Tensoflow and I try to implement it in a custom RNN project to learn more about how Neural Networks work.
My problem is simple but I don't seem to find any satisfying answer.
I am used to Numpy and operations on arrays using condition masks but I don't find a way to transform this with Tensors
def ELu(in_array):
in_array[in_array<= 0] = math.e ** in_array[in_array<= 0] - 1
return in_array
>>>print(ELu(np.array([1.0,0.0,-1.0])))
Gives me
[ 1. 0. -0.63212056]
And I would like to edit that function to be able to give me a similar Tensor if I do something like this
>>>print(ELu(tf.convert_to_tensor([1.0,0.0,-1.0])))
Which should give me
<tf.Tensor: shape=(3,), dtype=float32, numpy=array([ 1., 0., -0.63212056], dtype=float32)>
but accessing a tensor using a similar way in_array[in_array<= 0] doesn't work