theano.map
and theano.scan_module.reduce
are wrappers of theano_scan
. They can be seen as handicapped version of scan
. You can view Basic scan usage section for reference.
import theano
import theano.tensor as T
s_x = T.ivector()
s_sqr, _ = theano.map(
fn = lambda x:x*x,
sequences = [s_x])
s_sum, _ = theano.reduce(
fn = lambda: x,y:x+y,
sequences = [s_x],
outputs_info = [0])
fn = theano.function([s_x], [s_sqr, s_sum])
fn([1,2,3,4,5]) #[1,4,9,16,25], 15