当前位置: 首页>>代码示例>>Python>>正文


Python tensorflow.ifft2d方法代码示例

本文整理汇总了Python中tensorflow.ifft2d方法的典型用法代码示例。如果您正苦于以下问题:Python tensorflow.ifft2d方法的具体用法?Python tensorflow.ifft2d怎么用?Python tensorflow.ifft2d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tensorflow的用法示例。


在下文中一共展示了tensorflow.ifft2d方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: call

# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft2d [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) 
开发者ID:adalca,项目名称:neuron,代码行数:24,代码来源:layers.py

示例2: compute_fft

# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft2d [as 别名]
def compute_fft(x, direction="C2C", inverse=False):

    if direction == 'C2R':
        inverse = True

    x_shape = x.get_shape().as_list()
    h, w = x_shape[-2], x_shape[-3]

    x_complex = tf.complex(x[..., 0], x[..., 1])

    if direction == 'C2R':
        out = tf.real(tf.ifft2d(x_complex)) * h * w
        return out

    else:
        if inverse:
            out = stack_real_imag(tf.ifft2d(x_complex)) * h * w
        else:
            out = stack_real_imag(tf.fft2d(x_complex))
        return out 
开发者ID:tdeboissiere,项目名称:DeepLearningImplementations,代码行数:22,代码来源:scattering.py

示例3: test_IFFT2D

# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft2d [as 别名]
def test_IFFT2D(self):
        # only defined for gpu
        if DEVICE == GPU:
            t = tf.ifft2d(self.random(3, 4, complex=True))
            self.check(t) 
开发者ID:riga,项目名称:tfdeploy,代码行数:7,代码来源:ops.py

示例4: _tfIFFTForRank

# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft2d [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") 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:11,代码来源:fft_ops_test.py

示例5: fft2c

# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft2d [as 别名]
def fft2c(im,
          data_format='channels_last',
          orthonorm=True,
          transpose=False,
          name='fft2c'):
    """Centered FFT2 on last two non-channel dimensions."""
    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[-3] = permute_orig[-1]
            permute[-2:] = permute_orig[-3:-1]
            im_out = tf.transpose(im_out, permute)

        if orthonorm:
            fftscale = tf.sqrt(
                tf.cast(im_out.shape[-1], tf.float32) * tf.cast(
                    im_out.shape[-2], tf.float32))
        else:
            fftscale = 1.0
        fftscale = tf.cast(fftscale, dtype=tf.complex64)

        im_out = fftshift(im_out, axis=(-2, -1))
        if transpose:
            im_out = tf.ifft2d(im_out) * fftscale
        else:
            im_out = tf.fft2d(im_out) / fftscale
        im_out = fftshift(im_out, axis=(-2, -1))

        if data_format == 'channels_last':
            permute[-3:-1] = permute_orig[-2:]
            permute[-1] = permute_orig[-3]
            im_out = tf.transpose(im_out, permute)

    return im_out 
开发者ID:MRSRL,项目名称:dl-cs,代码行数:38,代码来源:tfmri.py

示例6: dc

# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft2d [as 别名]
def dc(generated, X_k, mask):
    gene_complex = real2complex(generated)
    gene_complex = tf.transpose(gene_complex,[0, 3, 1, 2])
    mask = tf.transpose(mask,[0, 3, 1, 2])
    X_k = tf.transpose(X_k,[0, 3, 1, 2])
    gene_fft = tf.fft2d(gene_complex)
    out_fft = X_k + gene_fft * (1.0 - mask)
    output_complex = tf.ifft2d(out_fft)
    output_complex = tf.transpose(output_complex, [0, 2, 3, 1])
    output_real = tf.cast(tf.real(output_complex), dtype=tf.float32)
    output_imag = tf.cast(tf.imag(output_complex), dtype=tf.float32)
    output = tf.concat([output_real,output_imag], axis=-1)
    return output 
开发者ID:CedricChing,项目名称:DeepMRI,代码行数:15,代码来源:model.py

示例7: setup_inputs

# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import ifft2d [as 别名]
def setup_inputs(x, mask, batch_size):

    channel = x.shape[-1].value // 2
    mask = np.tile(mask, (channel, 1, 1))
    mask_tf = tf.cast(tf.constant(mask), tf.float32)
    mask_tf_c = tf.cast(mask_tf, tf.complex64)
    x_complex = real2complex(x)
    x_complex = tf.cast(x_complex, tf.complex64)
    x_complex = tf.transpose(x_complex, [2, 0, 1])
    kx = tf.fft2d(x_complex)
    kx_mask = kx * mask_tf_c
    x_u = tf.ifft2d(kx_mask)
    x_u = tf.transpose(x_u, [1, 2, 0])
    kx_mask = tf.transpose(kx_mask, [1, 2, 0])

    x_u_cat = complex2real(x_u)
    x_cat = tf.cast(x, tf.float32)
    mask_tf_c = tf.transpose(mask_tf_c, [1, 2, 0])

    features, labels, kx_mask, masks = tf.train.shuffle_batch([x_u_cat,x_cat, kx_mask, mask_tf_c],
                                                     batch_size=batch_size,
                                                     num_threads=64,
                                                     capacity=50,
                                                     min_after_dequeue=10)

    return features, labels, kx_mask, masks 
开发者ID:CedricChing,项目名称:DeepMRI,代码行数:28,代码来源:data.py


注:本文中的tensorflow.ifft2d方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。