I want to create a Keras model with Tensorflow background that returns a vector with norm 1. For this purpose, the model ends with the next layer:
main_network = Lambda(lambda t: K.l2_normalize(t, axis=1))(x)
I have also created a test in which I only create the model and, without training, I make a random prediction to check that the output has norm 1. But the test fails:
AssertionError: 0.37070954 != 1 within 0.1 delta
So the Lambda layer is not working correctly since it is not normalizing the output. I tried different values for the axis parameter and with all possible values, the test fails. But am I missing?