Save the date! Google I/O returns May 18-20 Register now


TensorFlow 1 version View source on GitHub

Prints message and the tensor value when evaluated.

Note that print_tensor returns a new tensor identical to x which should be used in the following code. Otherwise the print operation is not taken into account during evaluation.


x = tf.constant([[1.0, 2.0], [3.0, 4.0]])
<tf.Tensor: shape=(2, 2), dtype=float32, numpy=
  array([[1., 2.],
         [3., 4.]], dtype=float32)>

x Tensor to print.
message Message to print jointly with the tensor.

The same tensor x, unchanged.