theano grad计算“非法返回整数值变量". [英] theano grad computation "illegally returned an integer-valued variable."

查看:84
本文介绍了theano grad计算“非法返回整数值变量".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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!

推荐答案

显然,只要在Theano中完成任何复数计算,就会出现此问题,与将绝对值发送到梯度计算无关紧要.我通过绕过任何复数计算来解决它.

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.

这篇关于theano grad计算“非法返回整数值变量".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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