How to get the dimension of a Tensor

In this article, you will see how to get the dimension of a tensor in TensorFlow. First, import the TensorFlow framework, then create a tensor and use the tensor.ndim function to find the dimension of a tensor. I highly recommend you get this book, “Deep Learning with TensorFlow 2 and Keras” to learn Deep Learning.

Python

Output:

The dimension of a Tensor is 2

Leave a Comment

Your email address will not be published.