TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning neural networks.
angle() is method in tensorflow math module. This method is used to find the element wise argument of a tensor. By default all elements are considered as complex number (a+bi). In case of real number complex part (b) is considered as zero. atan2(b,a) is the argument calculated by this function.
Syntax:
tensorflow.math.angle(
input, name
)
Argument:
1. input: It is a tensor. Allowed dtype for this tensor are float, double, complex64, complex128.
2. name: It is an optional argument that defines the name for the operation.
Return:
It returns a tensor of type float32 or float64.
Example 1:
Python3
# importing the libraray import tensorflow as tf # initializing the constant tensor a = tf.constant([-1.5 + 7.8j, 3 + 5.75j], dtype=tf.complex64) # calculating the arguments b = tf.math.angle(a) # printing the argument tensor print('Tensor: ',b) |
Output:
Tensor: tf.Tensor([1.7607845 1.0899091], shape=(2,), dtype=float32)
Example 2:
In case of real numbers calculated argument is always zero.
Python3
# importing the libraray import tensorflow as tf # initializing the constant tensor a = tf.constant([-1.5, 3 ], dtype=tf.float64) # calculating the arguments b = tf.math.angle(a) # printing the argument tensor print('Tensor: ',b) |
Output:
Tensor: tf.Tensor([0. 0.], shape=(2,), dtype=float64)
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.
Recommended Posts:
- Difference between Method Overloading and Method Overriding in Python
- class method vs static method in Python
- Get() method for dictionaries in Python
- Real-Time Edge Detection using OpenCV in Python | Canny edge detection method
- Python Program to detect the edges of an image using OpenCV | Sobel edge detection method
- Line detection in python with OpenCV | Houghline method
- Python | os._exit() method
- Python | os.WEXITSTATUS() method
- Python | os.abort() method
- Python | os.renames() method
- Python | os.lseek() method
- Python calendar module | formatmonth() method
- Python | PyTorch sin() method
- Python | Sympy Line.is_parallel() method
- Python PIL | GaussianBlur() method
- Python | range() method
- Python | Numpy np.hermefit() method
- Python | Numpy np.hermevander() method
- Python String Title method
- Python groupby method to remove all consecutive duplicates
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.

