View source on GitHub
|
Initializer that generates tensors initialized to 1.
tf.compat.v1.keras.initializers.Ones(
dtype=tf.dtypes.float32
)
Migrate to TF2
This API is compatible with TF2 behavior and tf.function, and can be
migrated immediately with tf.keras.initializers.ones.
Before:
>>> initializer = tf.compat.v1.keras.initializers.ones()
>>> initializer((1, 1))
<tf.Tensor: shape=(1, 1), dtype=float32, numpy=array([[1.]], dtype=float32)>
After:
>>> initializer = tf.keras.initializers.ones()
>>> initializer((1, 1))
<tf.Tensor: shape=(1, 1), dtype=float32, numpy=array([[1.]], dtype=float32)>
View source on GitHub