theano grad computation “illegally returned an integer-valued variable.”

为君一笑 提交于 2019-12-11 13:02:49

问题


I am computing a tensor which is a complex number, but then I take its magnitude and cast it as float32:

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

When I am trying to compute a cost function, I get the following error:

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

I have no idea why this is happening.Any help would be really appreciated!


回答1:


Apparently as long as any complex number computation is done in Theano, this problem arises, doesn't matter if the absolute value is being sent to the gradient computation. I fixed it by bypassing any complex number computation.



来源:https://stackoverflow.com/questions/36700835/theano-grad-computation-illegally-returned-an-integer-valued-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!