# tf.zeros

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/zeros) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/array_ops.py#L2303-L2352) |

Creates a tensor with all elements set to zero.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.zeros`](https://www.tensorflow.org/api_docs/python/tf/zeros), \`tf.compat.v2.zeros\`

<br />

    tf.zeros(
        shape, dtype=tf.dtypes.float32, name=None
    )

This operation returns a tensor of type `dtype` with shape `shape` and
all elements set to zero.

#### For example:

    tf.zeros([3, 4], tf.int32)  # [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]

<br />

<br />

<br />

| ## Args ||
|---|---|
| `shape` | A list of integers, a tuple of integers, or a 1-D `Tensor` of type `int32`. |
| `dtype` | The type of an element in the resulting `Tensor`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Tensor` with all elements set to zero. ||

<br />