W3cubDocs

/TensorFlow Python

tf.keras.backend.placeholder

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

Defined in tensorflow/python/keras/_impl/keras/backend.py.

Instantiates a placeholder tensor and returns it.

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.

Returns:

Tensor instance (with Keras metadata included).

Examples:

>>> from keras import backend as K
>>> input_ph = K.placeholder(shape=(2, 4, 5))
>>> input_ph
<tf.Tensor 'Placeholder_4:0' shape=(2, 4, 5) dtype=float32>

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/keras/backend/placeholder