You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
input = np.array([[0.04, -0.8, -1.2, 1.3, 0.85, 0.09, -0.08, 0.2]])
I want to change all the values (of the last dimension) between -0.1 and 0.1 to zero and change the rest to 1
filtred = [[0, 1, 1, 1, 1, 0, 0, 1]]
Using the lamnda layer is not my favor choice (I would prefer to find a solution with a native layer which could be easily converted to TfLite without activating the SELECT_TF_OPS or the TFLITE_BUILTINS options) but I tried it anyway :
layer = tf.keras.layers.Lambda(lambda x: 0 if x <0.1 and x>-0.1 else 1)
layer(input)
I am getting :
ValueError: Exception encountered when calling Lambda.call().
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Arguments received by Lambda.call():
• inputs=tf.Tensor(shape=(6,), dtype=float32)
• mask=None
• training=None
The text was updated successfully, but these errors were encountered:
Having an array like this :
input = np.array([[0.04, -0.8, -1.2, 1.3, 0.85, 0.09, -0.08, 0.2]])
I want to change all the values (of the last dimension) between -0.1 and 0.1 to zero and change the rest to 1
filtred = [[0, 1, 1, 1, 1, 0, 0, 1]]
Using the lamnda layer is not my favor choice (I would prefer to find a solution with a native layer which could be easily converted to TfLite without activating the
SELECT_TF_OPS
or theTFLITE_BUILTINS
options) but I tried it anyway :I am getting :
The text was updated successfully, but these errors were encountered: