## Issue

I tried to initialize a tensor with a specific name and print it with the following code:

```
import tensorflow as tf
r1 = tf.constant(1, tf.int16, shape=(), name="test")
print(r1)
```

But the output does not show the tensor name:

```
tf.Tensor(1, shape=(), dtype=int16)
```

Is there a reason why the output is like this? (I’ve seen examples of it working and showing the tensor name)

## Solution

This feature is available on `Tensorflow 1.x`

. You can get the tensor name by typing below code:

```
%tensorflow_version 1.x
import tensorflow as tf
r1 = tf.constant(1, tf.int16, shape=(), name="test")
print(r1)
```

Output:

```
TensorFlow 1.x selected.
Tensor("test:0", shape=(), dtype=int16)
```

Answered By – TFer2

**This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 **