Friday, December 12, 2025
HomeLanguagesPython | tensorflow.math.angle() method

Python | tensorflow.math.angle() method

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 library
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 library
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)
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32445 POSTS0 COMMENTS
Milvus
105 POSTS0 COMMENTS
Nango Kala
6813 POSTS0 COMMENTS
Nicole Veronica
11951 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12028 POSTS0 COMMENTS
Shaida Kate Naidoo
6946 POSTS0 COMMENTS
Ted Musemwa
7198 POSTS0 COMMENTS
Thapelo Manthata
6892 POSTS0 COMMENTS
Umr Jansen
6881 POSTS0 COMMENTS