當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python tf.math.imag用法及代碼示例

返回複數(或實數)張量的虛部。

用法

tf.math.imag(
    input, name=None
)

參數

  • input 一個Tensor。必須是以下類型之一:float , double , complex64 , complex128
  • name 操作的名稱(可選)。

返回

  • Tensor 類型為 float32float64

給定一個張量 input ,此操作返回一個類型為 float 的張量,它是 input 中每個元素的虛部,被視為複數。如果 input 為實數,則返回全零張量。

例如:

x = tf.constant([-2.25 + 4.75j, 3.25 + 5.75j])
tf.math.imag(x)  # [4.75, 5.75]

相關用法


注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.math.imag。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。