ó
¾÷Xc           @` s  d  Z  d d l m Z m Z m Z d Z d d l Z d d l Z e j d ƒ Z	 e j
 ƒ  Z e j d d ƒ Z e j e ƒ e	 j e ƒ e	 j e j ƒ d d l m Z d d	 l m Z d
 Z d d l m Z m Z m Z m Z m Z m Z m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& m' Z' m( Z( m) Z) m* Z* m+ Z+ m, Z, m- Z- d d l. m/ Z/ m0 Z0 m1 Z1 m2 Z2 m3 Z3 m4 Z4 m5 Z5 m6 Z6 m7 Z7 m8 Z8 m9 Z9 m: Z: m; Z; m< Z< m= Z= m> Z> d d l? m@ Z@ d d lA mB ZB mC ZC d d lD mE ZE mF ZF mG ZG mH ZH mI ZI mJ ZJ mK ZK d d lL mM ZM d d lN mO ZO mP ZP mQ ZQ mR ZR d d lS ZT eU eT jV d ƒ rneT jV jW ƒ  jX ZX n	 d „  ZX e jY jZ d ƒ s›e j[ jZ d ƒ rêd d l\ ZT eT j] j^ j_ rêd d l` ZT e ja rçeT j] j^ jV jb jc ƒ  qçqên  e jY jZ d ƒ sAe jY jZ d ƒ sAe j[ jZ d ƒ sAe j[ jZ d ƒ sAe jd d k rPd d le ZT n  d d lf Zf e jf jg d k rwd Zi n e jf jg Zi e jf jj d k ržd Zk n e jf jj Zk e jf jl d k rÅd Zm n e jf jl Zm e jf jn d k rìd Zo n e jf jn Zo e jf jp d k rd Zq n e jf jp Zq ef jr d ei d ek d em d eo d eq ƒ [i [k [m [o [q d „  Zs d „  Zt d  „  Zu ev d! ƒ d S("   sw  
Theano is an optimizing compiler in Python, built to evaluate
complicated expressions (especially matrix-valued ones) as quickly as
possible.  Theano compiles expression graphs (see :doc:`graph` ) that
are built by Python code. The expressions in these graphs are called
`Apply` nodes and the variables in these graphs are called `Variable`
nodes.

You compile a graph by calling `function`, which takes a graph, and
returns a callable object.  One of theano's most important features is
that `function` can transform your graph before compiling it.  It can
replace simple expressions with faster or more numerically stable
implementations.

To learn more, check out:

- Op List (:doc:`oplist`)

The markup language used in the docstrings is ReStructured Text,
which may be rendered with Sphinx. A rendered version is
maintained at http://www.deeplearning.net/software/theano/library/

i    (   t   absolute_importt   print_functiont   divisions   restructuredtext enNt   theanot   fmts%   %(levelname)s (%(name)s): %(message)s(   t   version(   t   configi   (   t   CLinkert   OpWiseCLinkert
   DualLinkert   Linkert   LocalLinkert   PerformLinkert	   Containert   InconsistencyErrort   FunctionGrapht   Applyt   Variablet   Constantt   Opt   OpenMPOpt   optt   toolboxt   Typet   Generict   generict   object2t   utils(   t   SymbolicInputt   Int   SymbolicOutputt   Outt   Modet   predefined_modest   predefined_linkerst   predefined_optimizerst   FunctionMakert   functiont   function_dumpt   OpFromGrapht   ProfileStatst   Paramt   sharedt   as_op(   t   _asarray(   t   pprintt   pp(   t   scant   mapt   reducet   foldlt   foldrt   clonet   scan_checkpoints(   t   OrderedUpdates(   t   Ropt   Lopt   gradt   subgraph_gradt   TheanoNoseTesterc           C` s   t  d ƒ ‚ d  S(   Ns@   The nose module is not installed. It is needed for Theano tests.(   t   ImportError(    (    (    s/   /tmp/pip-build-isqEY4/theano/theano/__init__.pyt   testg   s    t   gput   cudat   openclt    t   Nonet   allt   dividet   overt   undert   invalidc         C` sÔ   t  } d \ } } | t  k r_ t |  d ƒ r_ y |  j | ƒ } Wq_ t k
 r[ } t  } q_ Xn  | t  k r¬ t | d ƒ r¬ y | j |  ƒ } Wq¬ t k
 r¨ } t  } q¬ Xn  | t  k rÐ t d | | f ƒ ‚ n  | S(   s5   Return a symbolic matrix/dot product between l and r t   __dot__t   __rdot__s%   Dot failed for the following reasons:N(   NN(   t   NotImplementedRB   t   hasattrRH   t	   ExceptionRI   t   NotImplementedError(   t   lt   rt   rvalt   e0t   e1(    (    s/   /tmp/pip-build-isqEY4/theano/theano/__init__.pyt   dot    s     c         C` sx   d t  ƒ  k rk t |  j t j ƒ rk |  j d k	 rk t |  j j t j ƒ rk |  j j	 d } t
 j | ƒ Sn  t
 j |  ƒ S(   sU  return the constant scalar(0-D) value underlying variable `v`

    If v is the output of dimshuffles, fills, allocs, rebroadcasts, cast
    this function digs through them.

    If theano.sparse is also there, we will look over CSM op.

    If `v` is not some view of constant data, then raise a
    tensor.basic.NotScalarConstantError.
    t   sparsei    N(   t   globalst
   isinstancet   typeRT   t
   SparseTypet   ownerRB   t   opt   CSMt   inputst   tensort   get_scalar_constant_value(   t   vt   data(    (    s/   /tmp/pip-build-isqEY4/theano/theano/__init__.pyR^   µ   s
    $'c         C` sF   t  |  j j t j ƒ s t ‚ |  j j j d t ƒ |  j j Œ  } | S(   sü   This function return a new variable whose gradient will be
    stored in a sparse format instead of dense.

    Currently only variable created by AdvancedSubtensor1 is supported.
    i.e. a_tensor_var[an_int_vector].

    .. versionadded:: 0.6rc4
    t   sparse_grad(	   RV   RY   RZ   R]   t   AdvancedSubtensor1t   AssertionErrort	   __class__t   TrueR\   (   t   vart   ret(    (    s/   /tmp/pip-build-isqEY4/theano/theano/__init__.pyRa   È   s    	$s"   theano.tensor.shared_randomstreams(w   t   __doc__t
   __future__R    R   R   t   __docformat__t   loggingt   syst	   getLoggert   theano_loggert   StreamHandlert   logging_default_handlert	   Formattert   logging_default_formattert   setFormattert
   addHandlert   setLevelt   WARNINGt   theano.versionR   t   __version__t   theano.configdefaultsR   t   __api_version__t
   theano.gofR   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   theano.compileR   R   R   R   R    R!   R"   R#   R$   R%   R&   R'   R(   R)   R*   R+   t   theano.misc.safe_asarrayR,   t   theano.printingR-   R.   t   theano.scan_moduleR/   R0   R1   R2   R3   R4   R5   t   theano.updatesR6   t   theano.gradientR7   R8   R9   R:   t   theano.testsR   RK   t   testsR;   R=   t   devicet
   startswitht   init_gpu_devicet   theano.sandbox.cudat   sandboxR?   t   cuda_availablet%   theano.sandbox.cuda.tests.test_drivert   enable_initial_driver_testt   test_drivert   test_nvidia_driver1t   contextst   theano.gpuarrayt   numpyt
   seterr_allRB   t   _allt   seterr_dividet   _dividet   seterr_overt   _overt   seterr_undert   _undert   seterr_invalidt   _invalidt   seterrRS   R^   Ra   t
   __import__(    (    (    s/   /tmp/pip-build-isqEY4/theano/theano/__init__.pyt   <module>   s€   		ˆj
4"	$										