ó
àÆ÷Xc           @` sÁ  d  d l  m Z m Z m Z d  d l m Z d  d l m Z d  d l Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l m Z d  d l m Z d e f d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d d# d „  ƒ  YZ d d$ d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d  „  ƒ  YZ d! e f d" „  ƒ  YZ d S(%   i    (   t   absolute_importt   print_functiont   division(   t   partial(   t   OrderedDictN(   t   config(   t   grapht   AlreadyTherec           B` s   e  Z d  Z RS(   s¦   
    Raised by a Feature's on_attach callback method if the FunctionGraph
    attempting to attach the feature already has a functionally identical
    feature.

    (   t   __name__t
   __module__t   __doc__(    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR      s   t   ReplacementDidntRemovedErrorc           B` s   e  Z d  Z RS(   sÉ   
    This exception should be thrown by replace_all_validate_remove
    when an optimization wanted to remove a Variable or a Node from
    the graph, but the replacement it gived didn't do that.

    (   R   R	   R
   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR      s   t   Featurec           B` sG   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z	 RS(   sE  
    Base class for FunctionGraph extensions.

    A Feature is an object with several callbacks that are triggered
    by various operations on FunctionGraphs. It can be used to enforce
    graph properties at all stages of graph optimization.

    See Also
    --------
    theano.gof.toolbox : for common extensions.

    c         C` s   d S(   s§  
        Called by FunctionGraph.attach_feature, the method that attaches
        the feature to the FunctionGraph. Since this is called after the
        FunctionGraph is initially populated, this is where you should
        run checks on the initial contents of the FunctionGraph.

        The on_attach method may raise the AlreadyThere exception to cancel
        the attach operation if it detects that another Feature instance
        implementing the same functionality is already atttached to the
        FunctionGraph.

        The feature has great freedom in what it can do with the
        function_graph: it may, for example, add methods to it dynamically.

        N(    (   t   selft   function_graph(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt	   on_attach2   s    c         C` s   d S(   s›   
        Called by remove_feature(feature).  Should remove any dynamically-added
        functionality that it installed into the function_graph.

        N(    (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt	   on_detachC   s    c         C` s   d S(   sY  
        Called whenever a node is imported into function_graph, which is
        just before the node is actually connected to the graph.
        Note: on_import is not called when the graph is created. If you
        want to detect the first nodes to be implemented to the graph,
        you should do this by implementing on_attach.

        N(    (   R   R   t   nodet   reason(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt	   on_importJ   s    c         C` s   d S(   s‡   
        Called whenever a node is pruned (removed) from the function_graph,
        after it is disconnected from the graph.

        N(    (   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt   on_pruneT   s    c         C` s   d S(   s'  
        Called whenever node.inputs[i] is changed from r to new_r.
        At the moment the callback is done, the change has already
        taken place.

        If you raise an exception in this function, the state of the graph
        might be broken for all intents and purposes.

        N(    (   R   R   R   t   it   rt   new_rR   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt   on_change_input[   s    c         C` s   t  ƒ  S(   sA  
        Called by toposort. It should return a dictionary of
        {node: predecessors} where predecessors is a list of
        nodes that should be computed before the key node.

        If you raise an exception in this function, the state of the graph
        might be broken for all intents and purposes.

        (   R   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt	   orderingsf   s    
N(
   R   R	   R
   R   R   R   R   t   NoneR   R   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   $   s   			
	t
   Bookkeeperc           B` s   e  Z d  „  Z d „  Z RS(   c         C` s:   x3 t  j | j | j ƒ D] } |  j | | d ƒ q Wd S(   s#  
        Called by FunctionGraph.attach_feature, the method that attaches
        the feature to the FunctionGraph. Since this is called after the
        FunctionGraph is initially populated, this is where you should
        run checks on the initial contents of the FunctionGraph.
        R   N(   R   t   io_toposortt   inputst   outputsR   (   R   t   fgraphR   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   u   s    c         C` s:   x3 t  j | j | j ƒ D] } |  j | | d ƒ q Wd S(   su   
        Should remove any dynamically added functionality
        that it installed into the function_graph
        s   Bookkeeper.detachN(   R   R   R   R   R   (   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR      s    (   R   R	   R   R   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   s   s   	
t   GetCheckpointc           B` s   e  Z d  „  Z d „  Z RS(   c         C` s   | |  _  | |  _ d |  _ d  S(   Ni    (   t   hR   t   nb(   R   t   historyR   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt   __init__Š   s    		c         C` s)   g  |  j  j |  j <|  j d 7_ |  j S(   Ni   (   R!   R#   R   R"   (   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt   __call__   s    (   R   R	   R$   R%   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR    ˆ   s   	t   LambdExtractc           B` s   e  Z d d  „ Z d „  Z RS(   c         C` s1   | |  _  | |  _ | |  _ | |  _ | |  _ d  S(   N(   R   R   R   R   R   (   R   R   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR$   —   s
    				c         C` s.   |  j  j |  j |  j |  j d d |  j f ƒS(   NR   t   Revert(   R   t   change_inputR   R   R   R   (   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR%   ž   s    N(   R   R	   R   R$   R%   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR&   •   s   t   Historyc           B` sS   e  Z d  Z d d g Z d „  Z d „  Z d „  Z d „  Z d	 d „ Z	 d „  Z
 RS(
   sÖ   Keep an history of changes to an FunctionGraph.

    This history can be reverted up to the last checkpoint.. We can
    revert to only 1 point in the past. This limit was added to lower
    the memory usage.

    t
   checkpointt   revertc         C` s   i  |  _  d  S(   N(   R#   (   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR$   ­   s    c         C` se   t  | d ƒ s t  | d ƒ r- t d ƒ ‚ n  g  |  j | <t |  | ƒ | _ t |  j | ƒ | _ d  S(   NR*   R+   sF   History feature is already present or in conflict with another plugin.(   t   hasattrR   R#   R    R*   R   R+   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   °   s
    c         C` s+   t  |  | ƒ | _ t |  j | ƒ | _ d  S(   N(   R    R*   R   R+   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt   unpickle»   s    c         C` s   | `  | ` |  j | =d S(   su   
        Should remove any dynamically added functionality
        that it installed into the function_graph
        N(   R*   R+   R#   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   ¿   s    c         C` sG   |  j  | d  k r d  S|  j  | } | j t | | | | | ƒ ƒ d  S(   N(   R#   R   t   appendR&   (   R   R   R   R   R   R   R   R!   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   È   s    c         C` sc   |  j  | } d |  j  | <| j j | k s2 t ‚ x | rQ | j ƒ  } | ƒ  q5 W| |  j  | <d S(   sÅ   
        Reverts the graph to whatever it was at the provided
        checkpoint (undoes all replacements). A checkpoint at any
        given time can be obtained using self.checkpoint().

        N(   R#   R   R*   R"   t   AssertionErrort   pop(   R   R   R*   R!   t   f(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR+   Î   s    	N(   R   R	   R
   t   pickle_rm_attrR$   R   R-   R   R   R   R+   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR)   £   s   					t	   Validatorc           B` sA   e  Z d  d g Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   t   validatet
   consistentc         C` s]   x, d D]$ } t  | | ƒ r t d ƒ ‚ q q Wt |  j | ƒ | _ t |  j | ƒ | _ d  S(   NR4   t   validate_timesH   Validator feature is already present or in conflict with another plugin.(   s   validates   validate_time(   R,   R   R   t	   validate_R4   t   consistent_R5   (   R   R   t   attr(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   á   s
    c         C` s.   t  |  j | ƒ | _ t  |  j | ƒ | _ d  S(   N(   R   R7   R4   R8   R5   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR-   ì   s    c         C` s   | `  | ` d S(   su   
        Should remove any dynamically added functionality
        that it installed into the function_graph
        N(   R4   R5   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   ð   s    c         C` sö   t  j  ƒ  } y | j d ƒ } Wn¢ t k
 rÃ } t j ƒ  } | j } t j | ƒ } | j d k rj ‚  qÄ | j j	 d t
 ƒ } | r½ | j j	 d d ƒ }	 | j }
 t d |	 |
 | f ƒ n  ‚  n Xt  j  ƒ  } | j rò | j j | | 7_ n  | S(   sÂ   
        If the caller is replace_all_validate, just raise the
        exception. replace_all_validate will print out the
        verbose output. Or it has to be done here before raise.
        R4   t   replace_all_validatet   verboseR   t    s+   validate failed on node %s.
 Reason: %s, %s(   t   timet   execute_callbackst	   Exceptiont   inspectt   currentframet   f_backt   getframeinfot   functiont   f_localst   gett   Falset   printt   profileR6   (   R   R   t   t0t   rett   et   cft   uft   uf_infoR;   R   R   t   t1(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR7   ø   s(    			c         C` s+   y | j  ƒ  t SWn t k
 r& t SXd  S(   N(   R4   t   TrueR?   RG   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR8     s
    
(   R   R	   R2   R   R-   R   R7   R8   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR3   Þ   s   				!t   ReplaceValidatec           B` s…   e  Z d  d d g e j e j Z d „  Z d „  Z d „  Z d d „ Z	 d d d „ Z
 d e d „ Z d	 „  Z d
 „  Z d „  Z RS(   t   replace_validateR:   t   replace_all_validate_removec         C` su   x, d D]$ } t  | | ƒ r t d ƒ ‚ q q Wt ƒ  |  _ t |  _ t j |  | ƒ t j |  | ƒ |  j	 | ƒ d  S(   NRS   R:   RT   sN   ReplaceValidate feature is already present or in conflict with another plugin.(   s   replace_validates   replace_all_validates   replace_all_validate_remove(
   R,   R   t   sett   _nodes_removedRG   t   fail_validateR)   R   R3   R-   (   R   R   R9   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   &  s    
	c         C` sc   t  j |  | ƒ t j |  | ƒ t |  j | ƒ | _ t |  j | ƒ | _ t |  j | ƒ | _ d  S(   N(   R)   R-   R3   R   RS   R:   RT   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR-   2  s    	c         C` s<   t  j |  | ƒ t j |  | ƒ |  ` | ` | ` | ` d S(   su   
        Should remove any dynamically added functionality
        that it installed into the function_graph
        N(   R)   R   R3   RV   RS   R:   RT   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   ;  s    c         C` s#   |  j  | | | f g d | ƒd  S(   NR   (   R:   (   R   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyRS   G  s    c         C` s€  | j  ƒ  } | d  k r$ t j } n  t j j rj g  | j D]' } t | j t	 j
 j j ƒ r: | ^ q: } n  xÜ | D]Ô \ } }	 y  | j | |	 d | d t ƒWqq t k
 rD}
 t |
 ƒ } d } d } d } | | k rî |
 j d 7_ ‚  nC | | k r1| | k r1t j } t d t |
 ƒ |
 | d | ƒn  | j | ƒ ‚  qq Xqq Wy | j ƒ  WnC t k
 rœ}
 | j | ƒ | r–t d	 | | |
 f ƒ n  ‚  n Xt j j rcg  | j D]' } t | j t	 j
 j j ƒ r³| ^ q³} t | ƒ } t | ƒ } | | k r,t d
 | | t | d | ƒ | |	 ƒ qc| | k  rct d | | t | d | ƒ | |	 ƒ qcn  | r|t | | |	 ƒ n  | S(   NR   R;   s,   The type of the replacement must be the sames%   does not belong to this FunctionGraphs    maximum recursion depth exceededs›   Please, report this to theano-dev mailing list. As a temporary work around, you can raise Python stack limit with: import sys; sys.setrecursionlimit(10000)s-   <<!! BUG IN FGRAPH.REPLACE OR A LISTENER !!>>t   files+   validate failed on node %s.
 Reason: %s, %ss   Extra scan introducedt   names   Scan removed(   s›   Please, report this to theano-dev mailing list. As a temporary work around, you can raise Python stack limit with: import sys; sys.setrecursionlimit(10000)(   R*   R   R   t   optimizer_verboset   scant   debugt   apply_nodest
   isinstancet   opt   theanot   scan_modulet   scan_opt   Scant   replaceRG   R?   t   strt   argst   syst   stderrRH   t   typeR+   R4   t   lent   getattr(   R   R   t   replacementsR   R;   t   chkt   nt   scansR   R   RL   t   msgt   s1t   s2t   s3t   outt   scans2R"   t   nb2(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR:   J  sR    : 	7(+c   	      C` s£   | j  | | ƒ } |  j j | ƒ xz | D]r } | | j k sM | | j k r) | j | ƒ | r t j } t d d | ƒt | | d | ƒn  t	 ƒ  ‚ q) q) Wd S(   s–   
        As replace_all_validate, revert the replacement if the ops
        in the list remove are still in the graph. Also print a warning.

        s  WARNING: An optimization wanted to replace a Variable in the graph, but the replacement for it doesn't remove it. We disabled the optimization. Your function runs correctly, but it would be appreciated if you submit this problem to the mailing list theano-users so that we can fix it.RX   N(
   R:   RV   t   updateR]   t	   variablesR+   Rg   Rh   RH   R   (	   R   R   Rl   t   removeR   t   warnRm   t   rmRt   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyRT   €  s    	c         C` s)   |  j  j ƒ  } d | k r% | d =n  | S(   NR#   (   t   __dict__t   copy(   R   t   d(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt   __getstate__™  s    
c         C` s   | |  j  k r t |  _ n  d  S(   N(   RV   RQ   RW   (   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   Ÿ  s    c         C` s+   |  j  r' t |  _  t j j d ƒ ‚ n  d  S(   Ns$   Trying to reintroduce a removed node(   RW   RG   R`   t   goft   InconsistencyError(   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR4   £  s    		N(   R   R	   R)   R2   R3   R   R-   R   R   RS   R:   RQ   RT   R   R   R4   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyRR   !  s   				6		t
   NodeFinderc           B` s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C` s   d  |  _ i  |  _ d  S(   N(   R   R   R~   (   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR$   «  s    	c         C` sn   |  j  d  k	 r t d ƒ ‚ n  t | d ƒ r< t d ƒ ‚ n  | |  _  t |  j | ƒ | _ t j	 |  | ƒ d  S(   Ns7   A NodeFinder instance can only serve one FunctionGraph.t	   get_nodessA   NodeFinder is already present or in conflict with another plugin.(
   R   R   R?   R,   R   R   t   queryRƒ   R   R   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   ¯  s    	c         C` sA   |  j  | k	 r t d ƒ ‚ n  d |  _  | ` t j |  | ƒ d S(   su   
        Should remove any dynamically added functionality
        that it installed into the function_graph
        sA   This NodeFinder instance was not attached to the provided fgraph.N(   R   R?   R   Rƒ   R   R   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   º  s
    	c         C` sÆ   y# |  j  j | j g  ƒ j | ƒ Wnœ t k
 r7 d  St k
 rÁ } t d t | ƒ t | j ƒ d t j	 ƒy# t d t
 | j ƒ d t j	 ƒWn$ t k
 r· t d d t j	 ƒn X| ‚ n Xd  S(   Ns   OFFENDING nodeRX   s   OFFENDING node hashs   OFFENDING node not hashable(   R~   t
   setdefaultR_   R.   t	   TypeErrorR?   RH   Ri   Rg   Rh   t   hash(   R   R   R   R   RL   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   Æ  s    #(#c         C` sP   y |  j  | j } Wn t k
 r( d  SX| j | ƒ | sL |  j  | j =n  d  S(   N(   R~   R_   R†   Ry   (   R   R   R   R   t   nodes(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   Ó  s    c         C` sM   y |  j  j | g  ƒ } Wn! t k
 r< t d | ƒ ‚ n Xt | ƒ } | S(   Ns7   %s in unhashable and cannot be queried by the optimizer(   R~   RF   R†   t   list(   R   R   R_   t   all(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR„   Ü  s    (   R   R	   R$   R   R   R   R   R„   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR‚   ©  s   						t   PrintListenerc           B` sD   e  Z e d  „ Z d „  Z d „  Z d „  Z d „  Z d d „ Z	 RS(   c         C` s   | |  _  d  S(   N(   t   active(   R   RŒ   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR$   è  s    c         C` s   |  j  r t d | ƒ n  d  S(   Ns   -- attaching to: (   RŒ   RH   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   ë  s    	c         C` s   |  j  r t d | ƒ n  d S(   su   
        Should remove any dynamically added functionality
        that it installed into the function_graph
        s   -- detaching from: N(   RŒ   RH   (   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   ï  s    	c         C` s$   |  j  r  t d | | f ƒ n  d  S(   Ns   -- importing: %s, reason: %s(   RŒ   RH   (   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   ÷  s    	c         C` s$   |  j  r  t d | | f ƒ n  d  S(   Ns   -- pruning: %s, reason: %s(   RŒ   RH   (   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   û  s    	c         C` s*   |  j  r& t d | | | | f ƒ n  d  S(   Ns)   -- changing (%s.inputs[%s]) from %s to %s(   RŒ   RH   (   R   R   R   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR   ÿ  s    	N(
   R   R	   RQ   R$   R   R   R   R   R   R   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR‹   æ  s   				t   PreserveNamesc           B` s   e  Z d  Z d d „ Z RS(   sz   
    This preserve some variables names during optimization.

    Deprecated. We need to keep it to allow unpickling.
    c         C` s1   | j  d  k	 r- | j  d  k r- | j  | _  n  d  S(   N(   RY   R   (   R   R   R   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR     s    N(   R   R	   R
   R   R   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR     s   t   PreserveVariableAttributesc           B` s   e  Z d  Z d d „ Z RS(   sN   
    This preserve some variables attributes and tag during optimization.
    c         C` sv   | j  d  k	 r- | j  d  k r- | j  | _  n  t | j d t ƒ rr t | j d t ƒ t k rr | j j | j _ n  d  S(   Nt   nan_guard_mode_check(   RY   R   Rk   t   tagRG   R   (   R   R   R   R   R   R   R   (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR     s
    N(   R   R	   R
   R   R   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyRŽ     s   t   NoOutputFromInplacec           B` s    e  Z d  d d „ Z d „  Z RS(   i    c         C` s   | |  _  | |  _ d  S(   N(   t	   first_idxt   last_idx(   R   t   first_output_idxt   last_output_idx(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR$      s    	c      
   C` sÅ   t  | d ƒ s t St | j ƒ |  j |  j !} x | D]‡ } | j d  k rQ q6 n  | j } | j } | j j	 | ƒ } t  | d ƒ r6 | | j
 k r6 t j j d d d d | d d d	 ƒ ‚ q6 q6 Wd  S(
   Nt
   destroyerst   destroy_maps5   A function graph Feature has requested (probably for s6   efficiency reasons for scan) that outputs of the graphs.   be prevented from being the result of inplace s&   operations. This has prevented output s    from s-   being computed by modifying another variable s   inplace.(   R,   RQ   R‰   R   R’   R“   t   ownerR   R_   t   indexR—   R`   R€   R   (   R   R   t   outputs_to_validateRt   R   R_   t   out_idx(    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR4   $  s$    
				N(   R   R	   R   R$   R4   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyR‘     s   (    (    (   t
   __future__R    R   R   t	   functoolsR   t   collectionsR   Rg   R=   R@   R`   R   t
   theano.gofR   R?   R   R   t   objectR   R   R    R&   R)   R3   RR   R‚   R‹   R   RŽ   R‘   (    (    (    s2   /tmp/pip-build-X4mzal/theano/theano/gof/toolbox.pyt   <module>   s,   O;Cˆ=