fix: add get_value in tests
@@ -214,7 +214,8 @@ class AttentionTest(tf.test.TestCase, parameterized.TestCase):
attention_layer = dense_attention.Attention(score_mode='concat')
attention_layer.concat_score_weight = 1
attention_layer.build(input_shape=([1, 2, 4], [1, 3, 4]))
- actual = attention_layer._calculate_scores(query=q, key=k)
+ actual = keras.backend.get_value(
+ attention_layer._calculate_scores(query=q, key=k))
# pylint:disable=line-too-long
# expected000 = tanh(1.+1.5) + tanh(1.1+1.6) + tanh(1.2+1.7) + tanh(1.3+1.8) = 3.96753427840
@@ -269,7 +270,8 @@ class AttentionTest(tf.test.TestCase, parameterized.TestCase):
attention_layer.concat_score_weight = 1
attention_layer.build(input_shape=([1, 1, 1], [1, 1, 1]))
attention_layer.scale = 2.
- actual = attention_layer._calculate_scores(query=q, key=k)
+ actual = keras.backend.get_value(
+ attention_layer._calculate_scores(query=q, key=k))
# Expected tensor of shape [1, 1, 1].
# expected000 = tanh(2*(1.1+1.6)) = 0.9999592018254402
