codecamp

如何将TensorFlow的实数转换为复数

tf.complex

complex( 
    real, 
    imag, 
    name=None
 )

定义在:tensorflow/python/ops/math_ops.py.

参考指南:数学函数>复数函数

将两个实数转换为复数.

给定 real 表示复数的实部的张量和 imag 表示复数的虚部的张量,该操作的返回形式为 \(a + bj \)的元数字的复数,其中 a 表示 real 部分,b 表示 imag 部分.

输入的张量 real 和 imag 必须具有相同的形状.

例如:

# 张量 'real' 是 [2.25, 3.25]
# 张量 `imag` 是 [4.75, 5.75]
tf.complex(real, imag) ==> [[2.25 + 4.75j], [3.25 + 5.75j]]

ARGS:

  • real:张量.必须是以下类型之一:float32,float64.
  • imag:张量.必须与 real 具有相同的类型.
  • name:操作的名称(可选).

返回:

返回 complex64 或 complex128 类型的张量.

剪辑TensorFlow张量为指定的最大值和最小值
将TensorFlow张量沿一个维度串联
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }