title: Python - theano.scan() - return function values without feeding back into the loop
body: <p>Is it possible to return values calculated within the scan function without feeding them back into the scan function.</p>
  
  <p>e.g.</p>
  
  <pre><code>import theano
  import theano.tensor as T
  import numpy as np
  
  theano.config.exception_verbosity='high'
  theano.config.optimizer='None'
  
  def f(seq_v, prev_v):
      return seq_v*prev_v#, prev_v+1
  
  a = T.dvector('a')
  
  ini = T.constant(1, dtype=theano.config.floatX)
  
  result, updates = theano.scan(fn=f,
                                outputs_info=[ini],
                                sequences=[a],
                                non_sequences=None)
  
  fn  = theano.function(inputs=[a], outputs=result)
  
  A = np.arange(1,5)
  out = fn(A)
  
  print 'Values:\nf:\t{}'.format(out)
  </code></pre>
  
  <p>which gives</p>
  
  <pre><code>Values:
  f:  [  1.   2.   6.  24.]
  </code></pre>
  
  <p>However, I would like to output both of the values in <code>f()</code> without feeding the latter value back into the scan function:</p>
  
  <pre><code>def f(seq_v, prev_v):
      return seq_v*prev_v, prev_v+1
  </code></pre>
  
  <p>to give something like:</p>
  
  <pre><code>Values:
  f:  [ [1. , 2.]   [2. , 3.]   [6. , 4.]  [24. , 5.] ]
  </code></pre>
  
  <p><em>(I would just like to note that this problem is trivial but I would like to use the idea for debugging scan functions and checking output values)</em></p>