TensorFlow是Google設計的開源python庫,用於開發機器學習模型和深度學習神經網絡。
angle()是tensorflow數學模塊中的方法。此方法用於查找張量的元素明智參數。默認情況下,所有元素都被視為複數(a + bi)。如果是實數,則複數部分(b)被視為零。 atan2(b,a)是此函數計算的參數。
用法: 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. 返回: It returns a tensor of type float32 or float64.
範例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)
輸出:
Tensor: tf.Tensor([1.7607845 1.0899091], shape=(2,), dtype=float32)
範例2:
如果是實數,則計算的參數始終為零。
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)
輸出:
Tensor: tf.Tensor([0. 0.], shape=(2,), dtype=float64)
相關用法
- Python set()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python next()用法及代碼示例
- Python os.getcwdb()用法及代碼示例
- Python os.getgroups()用法及代碼示例
- Python range()用法及代碼示例
- Python os.access()用法及代碼示例
- Python PIL ImageOps.fit()用法及代碼示例
- Python Decimal ln()用法及代碼示例
- Python Decimal min()用法及代碼示例
- Python Decimal max()用法及代碼示例
- Python PIL UnsahrpMask()用法及代碼示例
- Python PyTorch add()用法及代碼示例
- Python PyTorch abs()用法及代碼示例
- Python os.lchown()用法及代碼示例
- Python os.fchown()用法及代碼示例
- Python os.chown()用法及代碼示例
- Python PyTorch div()用法及代碼示例
注:本文由純淨天空篩選整理自aman neekhara大神的英文原創作品 Python | tensorflow.math.angle() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。