张量流中的复杂卷积 [英] Complex convolution in tensorflow

查看:87
本文介绍了张量流中的复杂卷积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试进行简单的卷积运算,但是具有复杂的数字:

I'm trying to run a simple convolution but with complex numbers:

r = np.random.random([1,10,10,10])
i = np.random.random([1,10,10,10])
x = tf.complex(r,i)

conv_layer = tf.layers.conv2d(
            inputs=x,
            filters=10,
            kernel_size=[3,3],
            kernel_initializer=utils.truncated_normal_complex(),
            activation=tf.nn.sigmoid)

但是我收到此错误:

TypeError: Value passed to parameter 'input' has DataType complex128 not in list of allowed values: float16, float32

有人知道如何在Tensorflow中实现这种卷积吗?

Does anyone know how to implement such a convolution in Tensorflow?

我需要实现自定义操作,还是这里有更好的选择?

Will I need to implement a custom op, or is there some better option here?

令人沮丧的是,可能进行复杂的矩阵乘法,例如可以正常运行:

Frustratingly, complex matrix multiplication is possible, e.g. the following runs fine:

def r():
    return np.random.random([10,10])
A = tf.complex(r(),r())
B = tf.complex(r(),r())
C = tf.multiply(A,B)
sess.run(C)

所以我想,没有任何真正的原因卷积不起作用(因为卷积本质上只是矩阵乘法).

So there's no real reason convolution shouldn't work, I would think (as convolution is essentially just matrix multiplication).

谢谢

推荐答案

所有复数值特征均分为笛卡尔(实数,虚数)或极坐标(模数,角度)表示.没有人真正尝试使用纯粹复杂的单个功能.我希望证明自己是错的!

All complex-valued features are split into either Cartesian (real, imaginary) or polar (modulus, angle) representations. Nobody is really trying to use a single feature that is purely complex; I would love to be proven wrong!

这篇关于张量流中的复杂卷积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆