theano: gradient where cost is imag(x)
问题 If I have a cost that is the imaginary part of a complex number, trying to obtain the gradient with theano I get the following error: TypeError: Elemwise{imag,no_inplace}.grad illegally returned an integer-valued variable. (Input index 0, dtype complex128) Is it not possible to use the imaginary part as cost despite it being a real-valued cost? Edit. Minimal working example import theano.tensor as T from theano import function a = T.zscalar('a') f = function([a], T.grad(T.imag(a),a)) I would