From 1d872cb9628710bd09a924c554162be7364d109b Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Wed, 26 Oct 2022 16:45:01 +0100 Subject: [PATCH] contrastive: fix initial temperature value It should be 1/0.07, but we had it set to 0.07...... --- aimodel/src/lib/ai/components/LayerCheeseMultipleOut.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aimodel/src/lib/ai/components/LayerCheeseMultipleOut.py b/aimodel/src/lib/ai/components/LayerCheeseMultipleOut.py index 87c2e43..21f976d 100644 --- a/aimodel/src/lib/ai/components/LayerCheeseMultipleOut.py +++ b/aimodel/src/lib/ai/components/LayerCheeseMultipleOut.py @@ -16,7 +16,9 @@ class LayerCheeseMultipleOut(tf.keras.layers.Layer): self.param_batch_size = batch_size self.param_feature_dim = feature_dim - self.weight_temperature = tf.Variable(name="loss_temperature", shape=1, initial_value=tf.constant([0.07])) + self.weight_temperature = tf.Variable(name="loss_temperature", shape=1, initial_value=tf.constant([ + math.log(1 / 0.07) + ])) self.weight_nce = tf.Variable( name="loss_nce", shape=(batch_size, feature_dim),