'difference results of continuous call tf.keras.layers.DenseFeatures
Here is my code
import tensorflow as tf
age_buck = tf.feature_column.numeric_column('col1')
age_buck_column = tf.feature_column.bucketized_column(age_buck, [2, 4, 6, 8, 10])
age_embedding = tf.feature_column.embedding_column(age_buck_column, dimension=3, trainable=False)
input_layer2 = tf.keras.layers.DenseFeatures([age_embedding])
input_layer2({"col1":[[2]]})
The question is that I only run this cell twice and get different results.
input_layer2 = tf.keras.layers.DenseFeatures([age_embedding])
input_layer2({"col1":[[2]]})
Here are the results. First result.
<tf.Tensor: shape=(1, 3), dtype=float32, numpy=array([[-0.31282678, 0.6201095 , 0.98769945]], dtype=float32)>
Second result.
<tf.Tensor: shape=(1, 3), dtype=float32, numpy=array([[ 0.7076622 , 0.62326956, -0.5604797 ]], dtype=float32)>
I am very confused about what happened when we call
tf.keras.layers.DenseFeatures([age_embedding])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
