The problem I am having is that the Boolean Masking function does not return a tensor of the same shape that i fed it. Moreover, I cannot assign a NULL, ZERO or some default value to the cells that are below the cut off. Here is the code I have:
def NoiseFloor(x):
NFValue = tf.Variable(1.,dtype=tf.float64,constraint=lambda t: tf.clip_by_value(t, 10, 20))
y = tf.fill(tf.shape(x), NFValue)
y = tf.cast(y, np.float32)
return(tf.math.greater(x, y))
So I have been trying to solve this issue with no luck so far. I switched to trying to gain access to the elements in the tensor, so I could use an IF statement to make the element assignments. I tried a couple different functions:
tf.tensor_scatter_nd_add(
tf.assign_sub(
tf.assign(
Accessing the elements in the tensor itself (in v2) seems to be limited. Like I said I can:
Get a Bool Array of values above and below the cutoff
Apply a Bool Mask to that array and then get the values. But this array is not the same shape.
I also looked at recursive code to step through the elements in this array
I just do not think their isn’t an existing function that works with Tensorflow that does not already do this. I am going to look at SciPy if nobody gets back to me.