0

I am trying to create a tensor with numpy attribute and tried this:

tensor1 = tf.reshape(tf.constant([100, 100, 100], dtype=tf.int64), (-1, 1))

print(tensor1)

 #tensor1
 tf.Tensor(
[[100]
 [100]
 [100]], shape=(3, 1), dtype=int64)

But the output does not show the tensor ID or the numpy attribute where the values will be an array. How do I create a tensor of that format

1 Answer 1

1

It still has the numpy method, just call it:

tensor1 = tf.reshape(tf.constant([100, 100, 100], dtype=tf.int64), (-1, 1))

print(tensor1)
print(tensor1.numpy())

Also, look at the difference between

print(str(tensor1))

and

print(repr(tensor1))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.