Hi, I'm getting an error when trying to get the gradient of a function.
Basically, I want to use two parameters to define the lower and upper bound of an iterator. For easier understanding I simplified my code: from theano import theano, tensor as tt def get_sum(param1, param2): seq = tt.arange(param1, param2) components, _ = theano.scan(lambda index: index**2, outputs_info=None, sequences=[seq]) return tt.sum(components) param1 = tt.dscalar('param1') param1.tag.test_value = 0.0 param2 = tt.dscalar('param2') param2.tag.test_value = 10.0 objective = get_sum(param1, param2) obj_function = theano.function(inputs=[param1, param2],outputs=objective) obj_gradient = theano.gradient.jacobian(objective,[param1]) gradient_function = theano.function(inputs=[param1, param2], outputs=obj_gradient) --------------------------------------------------------------------------- ... TypeError: ARange{dtype='int64'}.grad illegally returned an integer-valued variable. (Input index 0, dtype int64) The function that is called in theano.scan (which is index**2 in the example) could be any function that uses the index as one of its parameters. What do I need to change about the code to make it work? The same error occurs when using theano version 0.8.2 or 0.9.0.dev-b3d19ce8e8d7cdf87c3f84599be81647803aa1f6 -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.