# tf.keras.backend.placeholder

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/backend/placeholder) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/keras/backend.py#L991-L1055) |

Instantiates a placeholder tensor and returns it.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.keras.backend.placeholder`](https://www.tensorflow.org/api_docs/python/tf/keras/backend/placeholder)

<br />

    tf.keras.backend.placeholder(
        shape=None, ndim=None, dtype=None, sparse=False, name=None, ragged=False
    )

<br />

<br />

<br />

| ## Arguments ||
|---|---|
| `shape` | Shape of the placeholder (integer tuple, may include `None` entries). |
| `ndim` | Number of axes of the tensor. At least one of {`shape`, `ndim`} must be specified. If both are specified, `shape` is used. |
| `dtype` | Placeholder type. |
| `sparse` | Boolean, whether the placeholder should have a sparse type. |
| `name` | Optional name string for the placeholder. |
| `ragged` | Boolean, whether the placeholder should have a ragged type. In this case, values of 'None' in the 'shape' argument represent ragged dimensions. For more information about RaggedTensors, see this [guide](https://www.tensorflow.org/guide/ragged_tensors). |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If called with eager execution |
| `ValueError` | If called with sparse = True and ragged = True. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Tensor instance (with Keras metadata included). ||

<br />

#### Examples:

    input_ph = tf.keras.backend.placeholder(shape=(2, 4, 5))
    input_ph
    <tf.Tensor 'Placeholder_...' shape=(2, 4, 5) dtype=float32>