將兩個實數轉換為複數。
用法
tf.dtypes.complex(
real, imag, name=None
)參數
-
real一個Tensor。必須是以下類型之一:float32、float64。 -
imag一個Tensor。必須與real具有相同的類型。 -
name操作的名稱(可選)。
返回
-
Tensor類型為complex64或complex128。
拋出
-
TypeErrorReal 和 imag 必須是正確的類型
給定一個張量real表示複數的實部和張量imag表示複數的虛部,此操作返回形式為元素的複數,其中a代表real部分和b代表imag部分。
輸入張量 real 和 imag 必須具有相同的形狀。
例如:
real = tf.constant([2.25, 3.25])
imag = tf.constant([4.75, 5.75])
tf.complex(real, imag) # [[2.25 + 4.75j], [3.25 + 5.75j]]
相關用法
- Python tf.dtypes.DType用法及代碼示例
- Python tf.dtypes.DType.is_compatible_with用法及代碼示例
- Python tf.distribute.OneDeviceStrategy.experimental_distribute_values_from_function用法及代碼示例
- Python tf.data.Dataset.take_while用法及代碼示例
- Python tf.data.experimental.RandomDataset.group_by_window用法及代碼示例
- Python tf.data.TFRecordDataset.filter用法及代碼示例
- Python tf.data.TextLineDataset.reduce用法及代碼示例
- Python tf.data.TextLineDataset.with_options用法及代碼示例
- Python tf.data.experimental.SqlDataset.enumerate用法及代碼示例
- Python tf.data.TextLineDataset.as_numpy_iterator用法及代碼示例
- Python tf.data.experimental.make_saveable_from_iterator用法及代碼示例
- Python tf.distribute.TPUStrategy用法及代碼示例
- Python tf.data.TextLineDataset.random用法及代碼示例
- Python tf.data.FixedLengthRecordDataset.repeat用法及代碼示例
- Python tf.data.TFRecordDataset.random用法及代碼示例
- Python tf.data.Dataset.cardinality用法及代碼示例
- Python tf.distribute.experimental_set_strategy用法及代碼示例
- Python tf.data.FixedLengthRecordDataset.cardinality用法及代碼示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy.gather用法及代碼示例
- Python tf.distribute.cluster_resolver.TFConfigClusterResolver用法及代碼示例
- Python tf.data.TextLineDataset.take_while用法及代碼示例
- Python tf.data.experimental.SqlDataset.zip用法及代碼示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy用法及代碼示例
- Python tf.data.experimental.Counter用法及代碼示例
- Python tf.distribute.TPUStrategy.experimental_assign_to_logical_device用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.dtypes.complex。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
