ó
àÆ÷Xc           @` sº   d  Z  d d l m Z m Z m Z d Z d Z d Z d Z d d l	 Z	 d d l
 m Z e	 j d	 ƒ Z d d
 e d d d „ Z d e d d d „ Z d d d d „ Z d d d d „ Z d S(   sZ   
This module provides syntax shortcut for the Scan Op.

See scan.py for details on scan.

i    (   t   absolute_importt   print_functiont   divisions   restructedtext ens>   Razvan Pascanu Frederic Bastien James Bergstra Pascal Lamblin s    (c) 2010, Universite de Montreals    Razvan Pascanu <r.pascanu@gmail>N(   t   scans   theano.scan_module.scan_viewsiÿÿÿÿc         C` s7   t  d |  d | d g  d | d | d | d | d | ƒ S(	   sÚ  
    Similar behaviour as python's map.

    Parameters
    ----------
    fn
        The function that ``map`` applies at each iteration step
        (see ``scan`` for more info).
    sequences
        List of sequences over which ``map`` iterates 
        (see ``scan`` for more info).
    non_sequences
        List of arguments passed to ``fn``. ``map`` will not iterate over
        these arguments (see ``scan`` for more info).
    truncate_gradient
        See ``scan``.
    go_backwards : bool
        Decides the direction of iteration. True means that sequences are parsed
        from the end towards the begining, while False is the other way around.
    mode
        See ``scan``.
    name
        See ``scan``.

    t   fnt	   sequencest   outputs_infot   non_sequencest   truncate_gradientt   go_backwardst   modet   name(   R   (   R   R   R   R   R	   R
   R   (    (    s=   /tmp/pip-build-X4mzal/theano/theano/scan_module/scan_views.pyt   map   s     c   	      C` s•   t  d |  d | d | d | d | d d d | d	 | ƒ } t | d
 t t f ƒ r{ g  | d
 D] } | d ^ q] | d f S| d
 d | d f Sd S(   s\  
    Similar behaviour as python's reduce.

    Parameters
    ----------
    fn
        The function that ``reduce`` applies at each iteration step
        (see ``scan``  for more info).
    sequences
        List of sequences over which ``reduce`` iterates
        (see ``scan`` for more info).
    outputs_info
        List of dictionaries describing the outputs of
        reduce (see ``scan`` for more info).
    non_sequences
        List of arguments passed to ``fn``. ``reduce`` will
                          not iterate over these arguments (see ``scan`` for
                          more info).
    go_backwards : bool 
        Decides the direction of iteration. True means that sequences are parsed
        from the end towards the begining, while False is the other way around.
    mode
        See ``scan``.
    name
        See ``scan``.

    R   R   R   R   R	   R   iÿÿÿÿR
   R   i    i   N(   R   t
   isinstancet   listt   tuple(	   R   R   R   R   R	   R
   R   t   rvalt   x(    (    s=   /tmp/pip-build-X4mzal/theano/theano/scan_module/scan_views.pyt   reduceJ   s    "	)c         C` s1   t  d |  d | d | d | d t d | d | ƒ S(   sp  
    Similar behaviour as haskell's foldl.

    Parameters
    ----------
    fn
        The function that ``foldl`` applies at each iteration step
        (see ``scan`` for more info).
    sequences
        List of sequences over which ``foldl`` iterates
        (see ``scan`` for more info).
    outputs_info
        List of dictionaries describing the outputs of reduce
        (see ``scan`` for more info).
    non_sequences
        List of arguments passed to `fn`. ``foldl`` will not iterate over
        these arguments (see ``scan`` for more info).
    mode
        See ``scan``.
    name
        See ``scan``.

    R   R   R   R   R	   R
   R   (   R   t   False(   R   R   R   R   R
   R   (    (    s=   /tmp/pip-build-X4mzal/theano/theano/scan_module/scan_views.pyt   foldl{   s    c         C` s1   t  d |  d | d | d | d t d | d | ƒ S(   so  
    Similar behaviour as haskell' foldr.

    Parameters
    ----------
    fn
        The function that ``foldr`` applies at each iteration step
        (see ``scan`` for more info).
    sequences
        List of sequences over which ``foldr`` iterates
        (see ``scan`` for more info).
    outputs_info
        List of dictionaries describing the outputs of reduce
        (see ``scan`` for more info).
    non_sequences
        List of arguments passed to `fn`. ``foldr`` will not iterate over these
        arguments (see ``scan`` for more info).
    mode
        See ``scan``.
    name
        See ``scan``.

    R   R   R   R   R	   R
   R   (   R   t   True(   R   R   R   R   R
   R   (    (    s=   /tmp/pip-build-X4mzal/theano/theano/scan_module/scan_views.pyt   foldr¢   s    (   t   __doc__t
   __future__R    R   R   t   __docformat__t   __authors__t   __copyright__t   __contact__t   loggingt   theano.scan_moduleR   t	   getLoggert   _loggert   NoneR   R   R   R   R   (    (    (    s=   /tmp/pip-build-X4mzal/theano/theano/scan_module/scan_views.pyt   <module>   s.   (.%