|TensorFlow 1 version||View source on GitHub|
Creates a tensor with all elements set to zero.
tf.zeros( shape, dtype=tf.dtypes.float32, name=None )
Used in the guide:
- Writing custom layers and models with Keras
- The Keras functional API in TensorFlow
- Better performance with tf.function and AutoGraph
- Training checkpoints
- Migrate your TensorFlow 1 code to TensorFlow 2
Used in the tutorials:
- Custom layers
- Better performance with tf.function
- Neural machine translation with attention
- Custom training: basics
- Custom training with tf.distribute.Strategy
This operation returns a tensor of type
dtype with shape
all elements set to zero.
tf.zeros([3, 4], tf.int32) # [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
shape: A list of integers, a tuple of integers, or a 1-D
dtype: The type of an element in the resulting
name: A name for the operation (optional).
Tensor with all elements set to zero.