Closed ghost closed 4 years ago
I'm rewriting this project on PyTorch and got confused with the code below. if mode == 'eval': y = keras.layers.Lambda(lambda x: keras.backend.l2_normalize(x, 1))(x) Is there some special reason behind that?
if mode == 'eval': y = keras.layers.Lambda(lambda x: keras.backend.l2_normalize(x, 1))(x)
Oh, this is for evaluating the cosine similarity,
you can either normalise in the model, or get the output embedding and normalise with bumpy.
Thank you for the quick reply!
I'm rewriting this project on PyTorch and got confused with the code below.
if mode == 'eval': y = keras.layers.Lambda(lambda x: keras.backend.l2_normalize(x, 1))(x)
Is there some special reason behind that?