theano 毕业计算 "illegally returned an integer-valued variable."

theano grad computation "illegally returned an integer-valued variable."

我正在计算一个张量,它是一个复数,但随后我将其量值转换为 float32:

x = theano.tensor.abs_(cum).astype(theano.config.floatX)

当我尝试计算成本函数时,出现以下错误:

TypeError: Elemwise{abs_,no_inplace}.grad  (Input index 0, dtype complex128)

我不知道为什么会这样 happening.Any 非常感谢帮助!

显然,只要在Theano中进行任何复数计算,就会出现这个问题,无论是否将绝对值发送到梯度计算都无关紧要。我通过绕过任何复数计算来修复它。