contrastive: fix initial temperature value

It should be 1/0.07, but we had it set to 0.07......
This commit is contained in:
Starbeamrainbowlabs 2022-10-26 16:45:01 +01:00
parent f994d449f1
commit 1d872cb962
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -16,7 +16,9 @@ class LayerCheeseMultipleOut(tf.keras.layers.Layer):
self.param_batch_size = batch_size self.param_batch_size = batch_size
self.param_feature_dim = feature_dim 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( self.weight_nce = tf.Variable(
name="loss_nce", name="loss_nce",
shape=(batch_size, feature_dim), shape=(batch_size, feature_dim),