问题
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