# tf.zeros

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/zeros) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.4.0/tensorflow/python/ops/array_ops.py#L2826-L2882) |

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)

<br />

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

See also [`tf.zeros_like`](https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/zeros_like), [`tf.ones`](https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/ones), [`tf.fill`](https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/fill), [`tf.eye`](https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/eye).

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

    tf.zeros([3, 4], tf.int32)
    <tf.Tensor: shape=(3, 4), dtype=int32, numpy=
    array([[0, 0, 0, 0],
           [0, 0, 0, 0],
           [0, 0, 0, 0]], dtype=int32)>

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

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

<br />