Hi! I am trying to use estimate the parameters of a surface given reflectance data using a physical scattering model (mostly a complicated function). Everything works fine until the sampling, in which this error raises,

```
TypeError: Elemwise{real,no_inplace}.grad illegally returned an integer-valued variable. (Input index 0, dtype complex128)
```

I only found one reference here in which is stated that this error raises when Theano founds a complex number, even if the resulting value is real (as is this case, in which I am computing the reflectivity and not its phase). Their solution (to bypass complex numbers) is not possible in my case. Is there any other work around?

Thank you for the feedback.