本文整理汇总了Python中tensorflow.ifft方法的典型用法代码示例。如果您正苦于以下问题:Python tensorflow.ifft方法的具体用法?Python tensorflow.ifft怎么用?Python tensorflow.ifft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow
的用法示例。
在下文中一共展示了tensorflow.ifft方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: call
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft [as 别名]
def call(self, inputx):
if not inputx.dtype in [tf.complex64, tf.complex128]:
print('Warning: inputx is not complex. Converting.', file=sys.stderr)
# if inputx is float, this will assume 0 imag channel
inputx = tf.cast(inputx, tf.complex64)
# get the right fft
if self.ndims == 1:
ifft = tf.ifft
elif self.ndims == 2:
ifft = tf.ifft2d
else:
ifft = tf.ifft3d
perm_dims = [0, self.ndims + 1] + list(range(1, self.ndims + 1))
invert_perm_ndims = [0] + list(range(2, self.ndims + 2)) + [1]
perm_inputx = K.permute_dimensions(inputx, perm_dims) # [batch_size, nb_features, *vol_size]
ifft_inputx = ifft(perm_inputx)
return K.permute_dimensions(ifft_inputx, invert_perm_ndims)
示例2: _ifft
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft [as 别名]
def _ifft(bottom, sequential, compute_size):
if sequential:
return sequential_batch_ifft(bottom, compute_size)
else:
return tf.ifft(bottom)
示例3: _tfIFFTForRank
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft [as 别名]
def _tfIFFTForRank(self, rank):
if rank == 1:
return tf.ifft
elif rank == 2:
return tf.ifft2d
elif rank == 3:
return tf.ifft3d
else:
raise ValueError("invalid rank")
示例4: fftc
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft [as 别名]
def fftc(im,
data_format='channels_last',
orthonorm=True,
transpose=False,
name='fftc'):
"""Centered FFT on last non-channel dimension."""
with tf.name_scope(name):
im_out = im
if data_format == 'channels_last':
permute_orig = np.arange(len(im.shape))
permute = permute_orig.copy()
permute[-2] = permute_orig[-1]
permute[-1] = permute_orig[-2]
im_out = tf.transpose(im_out, permute)
if orthonorm:
fftscale = tf.sqrt(tf.cast(im_out.shape[-1], tf.float32))
else:
fftscale = 1.0
fftscale = tf.cast(fftscale, dtype=tf.complex64)
im_out = fftshift(im_out, axis=-1)
if transpose:
im_out = tf.ifft(im_out) * fftscale
else:
im_out = tf.fft(im_out) / fftscale
im_out = fftshift(im_out, axis=-1)
if data_format == 'channels_last':
im_out = tf.transpose(im_out, permute)
return im_out
示例5: _cconv
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft [as 别名]
def _cconv(self, a, b):
return tf.ifft(tf.fft(a) * tf.fft(b)).real
示例6: _ccorr
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft [as 别名]
def _ccorr(self, a, b):
a = tf.cast(a, tf.complex64)
b = tf.cast(b, tf.complex64)
return tf.real(tf.ifft(tf.conj(tf.fft(a)) * tf.fft(b)))