TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning neural networks.
To create a numpy array from Tensor, Tensor is converted to a proto tensor first.
- make_ndarray: This method accepts a TensorProto as input and returns a numpy array with same content as TensorProto.
Value: tf.Tensor([ 1. 15. 10.], shape=(3, ), dtype=float64) Result: [ 1. 15. 10.]
Example 2: This example uses a Tensor with shape (2, 2) so the shape of resulting array will be (2, 2).
Value: tf.Tensor( [[1. 2.] [3. 4.]], shape=(2, 2), dtype=float64) Result: [[1. 2.] [3. 4.]]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- TensorFlow - How to create a tensor of all ones that has the same shape as the input tensor
- TensorFlow - How to create one hot tensor
- TensorFlow - How to create a tensor with all elements set to one
- Introduction to Tensor with Tensorflow
- TensorFlow - How to stack a list of rank-R tensors into one rank-(R+1) tensor in parallel
- TensorFlow - How to add padding to a tensor
- Python | Numpy numpy.ndarray.__lt__()
- Python | Numpy numpy.ndarray.__gt__()
- Python | Numpy numpy.ndarray.__le__()
- Python | Numpy numpy.ndarray.__ge__()
- Python | Numpy numpy.ndarray.__eq__()
- Python | Numpy numpy.ndarray.__ne__()
- Python | Numpy numpy.ndarray.__neg__()
- Python | Numpy numpy.ndarray.__pos__()
- Python | Numpy numpy.ndarray.__truediv__()
- Python | Numpy numpy.ndarray.__mul__()
- Python | Numpy numpy.ndarray.__sub__()
- Python | Numpy numpy.ndarray.__add__()
- Python | Numpy numpy.ndarray.__floordiv__()
- Python | Numpy numpy.ndarray.__mod__()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.