I'm sorry but where can I find documentation on destroy_map ? There is close to no mention of it in the theano doc. I searched through the code to find examples, but I'm not sure I understand exactly. My intuition is that it's a dictionnary linking output (here output[0]) to input (here x)  which shares memory, is it right ? If so will something like destroy_map={x: output[0]} do the work ?