ó
àÆ÷Xc           @` s/  d  d l  m Z m Z 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  d l m Z d  d l Z e j ƒ  e j e e d „ Z e d e j d e j j d	 e d
 e d e d e d e d e d e j d d „  d d „  d d „  d e j d e d d ƒ Z d „  Z d S(   i    (   t   absolute_importt   print_functiont   divisionN(   t   tensor(   t   unittest_tools(   t   may_share_memoryc         ` s€   d t  j f ‡  ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡	 ‡
 ‡ ‡ ‡ f d †  ƒ  Y} | t k	 sX t ‚ | | _ t | d ƒ r| | | _ n  | S(   s›  
    This is a generic fct to allow reusing the same test function
    for many shared variable of many types.

    :param shared_constructor_: The shared variable constructor to use
    :param dtype_: The dtype of the data to test
    :param get_value_borrow_true_alias_: Should a get_value(borrow=True) return the internal object
    :param shared_borrow_true_alias_: Should shared(val,borrow=True) reuse the val memory space
    :param set_value_borrow_true_alias_: Should set_value(val,borrow=True) reuse the val memory space
    :param set_value_inplace_: Should this shared variable overwrite the current
                               memory when the new value is an ndarray
    :param set_cast_value_inplace_: Should this shared variable overwrite the
                               current memory when the new value is of the same
                               type as the internal type.
    :param shared_constructor_accept_ndarray_: Do the shared_constructor accept an ndarray as input?
    :param internal_type_: The internal type used.
    :param test_internal_type_: A function that tell if its input is of the same
                                type as this shared variable internal type.
    :param theano_fct_: A theano op that will be used to do some computation on the shared variable
    :param ref_fct_: A reference function that should return the same value as the theano_fct_
    :param cast_value_: A callable that cast an ndarray into the internal shared variable representation
    :param op_by_matrix_: When we do inplace operation on the an internal type object, should we do it with a scalar or a matrix of the same value.
    :param name: This string is used to set the returned class' __name__
                 attribute. This is needed for nosetests to properly tag the
                 test with its correct name, rather than use the generic
                 SharedTester name. This parameter is mandatory (keeping the
                 default None value will raise an error), and must be set to
                 the name of the variable that will hold the returned class.
    :note:
        We must use /= as sparse type don't support other inplace operation.


    t   SharedTesterc           ` sæ   e  Z e ˆ
 ƒ Z ˆ Z ˆ Z ˆ	 Z ˆ Z e ˆ ƒ Z e ˆ ƒ Z	 e ˆ ƒ Z
 ˆ Z ˆ Z ˆ Z ˆ Z e ˆ  ƒ Z ˆ Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z RS(   c         S` s  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } |  j | d t ƒ} |  j | ƒ } t j g  | ƒ } | ƒ  } t j |  j | ƒ | ƒ sä t ‚ d }	 |  j r0|  j t j | j d | ƒd ƒ }	 |  j |	 ƒ s0t ‚ n  | |	 } | ƒ  }
 t j | |
 ƒ s[t ‚ | j d t ƒ } | |	 } | ƒ  } t j | | ƒ s˜t ‚ | j d t ƒ } | |	 } |  j rät j |  j | ƒ | ƒ  ƒ sÿt ‚ n t j | | ƒ  ƒ sÿt ‚ d  S(   Ni    i   i   i   t   dtypet   borrowg      à?(   R   t   Nonet   theanot   configt   floatXt   numpyt   randomt   RandomStatet   uttt
   fetch_seedt   asarrayt   uniformt
   cast_valuet   ref_fctt   shared_constructort   Falset
   theano_fctt   functiont   allcloset   AssertionErrort   op_by_matrixt   internal_typet   onest   shapet   test_internal_typet	   get_valuet   Truet   get_value_borrow_true_alias(   t   selfR   t   rngt   xt   x_reft   x_sharedt   totalt
   total_funct	   total_valt   values_to_divt   total_val_2t   total_val_3(    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_shared_dont_aliasP   s8    	*	!	%
	
	
	'c   	      S` s„  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } |  j | d t ƒ} |  j | ƒ } t j g  | j ƒ } | j j j ƒ  } t j | ƒ  d	 k ƒ sí t ‚ t j j d k r€t | ƒ d k st ‚ t | d j t j j ƒ s9t ‚ t | d j t j j ƒ s[t ‚ t | d j t j j ƒ s€t ‚ n  d  S(
   Ni    i   i   i   R   R   t   FAST_COMPILEi   (   i   i   (    R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   makert   fgrapht   toposortt   allR   t   modet   lent
   isinstancet   opR   t   optt   Shape_it
   MakeVector(	   R$   R   R%   R&   R'   R(   R)   t   ft   topo(    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt
   test_shape   s"    	*""c   	      S` sD  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } |  j | d t ƒ} |  j | ƒ } t j g  | j d ƒ } | j j j ƒ  } t j | ƒ  d k ƒ sñ t ‚ t j j d k r@t | ƒ d k st ‚ t | d j t j j ƒ s@t ‚ n  d  S(   Ni    i   i   i   R   R   R0   (   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R1   R2   R3   R4   R   R5   R6   R7   R8   R   R9   R:   (	   R$   R   R%   R&   R'   R(   R)   R<   R=   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_shape_i˜   s    	*c   	      S` sÄ  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } |  j | d t ƒ} |  j | ƒ } t j g  | ƒ } | j d t d t ƒ } |  j | ƒ sç t ‚ d } |  j r|  j t j | j d | ƒd ƒ } n  | | } t j |  j | ƒ | ƒ  ƒ sLt ‚ | j d t d t ƒ } |  j | ƒ syt ‚ | | j j k	 s‘t ‚ | | } t j |  j | ƒ | ƒ  ƒ sÀt ‚ d  S(	   Ni    i   i   i   R   R   t   return_internal_typeg      à?(   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R!   R"   R    R   R   R   R   R   R   t	   containert   value(	   R$   R   R%   R&   R'   R(   R)   R*   R,   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_return_internal_type­   s.    	*	"
$
c         S` së   |  j  } | d k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j r´ |  j | d t ƒ} t | j ƒ  | j ƒ s´ t ‚ n  |  j | d t ƒ} t | j ƒ  | j ƒ sç t ‚ d S(   sv   
            Test that get_value return the same type as what was gived when creating the shared variable
            i    i   i   i   R   R   N(   R   R	   R
   R   R   R   R   R   R   R   R   R   R   t!   shared_constructor_accept_ndarrayR   R   R7   R!   t	   __class__R   (   R$   R   R%   t   x_origt   x_castR(   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_get_valueÓ   s    	*	!c         S` s  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } | } | j ƒ  } |  j | ƒ } |  j | d t ƒ} |  j | ƒ } t j g  | ƒ }	 |	 ƒ  d }
 |  j r|  j t j | j d | ƒd ƒ }
 |  j |
 ƒ st ‚ n  | j d t ƒ } | | k	 sCt ‚ | |
 } | j | d t ƒ| j d t ƒ } |  j r| | k s¢t ‚ n | | k	 s¢t ‚ t j |  j t j
 | ƒ d ƒ |  j | ƒ ƒ sÙt ‚ | j d t d t ƒ } | | k	 st ‚ |  j | ƒ st ‚ | |
 } |  j | ƒ s7t ‚ | j | d t ƒ| j d t d t ƒ } |  j | ƒ swt ‚ | | k s‰t ‚ d  S(	   Ni    i   i   i   R   R   g      à?R@   (   R   R	   R
   R   R   R   R   R   R   R   R   R   R   t   copyR   R   R   R   R   R   R   R   R   R    R   R!   R"   t	   set_valuet   set_value_borrow_true_aliasR   (   R$   R   R%   R&   RF   t   x_orig_copyR'   R(   R)   R*   R,   t   get_x(    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_set_valueå   sF    	*	%
	7
c   
      S` s‰  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } |  j | d t ƒ} |  j | ƒ } t j g  | ƒ } | ƒ  } t j |  j | ƒ | ƒ sä t ‚ d }	 |  j r0|  j t j | j d | ƒd ƒ }	 |  j |	 ƒ s0t ‚ n  | |	 } |  j rjt j |  j | ƒ | ƒ  ƒ s…t ‚ n t j | | ƒ  ƒ s…t ‚ d  S(   Ni   i   i   R   R   g      à?(   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R"   R   R   R   R   R   R   R   R   R    t   shared_borrow_true_alias(
   R$   R   R%   R&   R'   R(   R)   R*   R+   R,   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_shared_do_alias  s(    	*	!	%
	'c         S` sÄ  |  j  } | d
 k r$ t j j } n  d } t j | d | ƒ} |  j | ƒ } |  j | d t	 ƒ} | j
 j d } t j | d | ƒ} | j j d k rñ| | j
 j (t j | j d t	 ƒ ƒ | k j ƒ  sÔ t ‚ t | | j
 j d ƒ só t ‚ t | | j d t	 d t	 ƒ ƒ st ‚ | d c d	 7<| d | j
 j d <t j | j d t	 ƒ d ƒ | d k j ƒ  sst ‚ t j | j d t	 ƒ d	 ƒ | d	 k j ƒ  s¨t ‚ t | | j
 j d ƒ sÇt ‚ t | | j d t	 d t	 ƒ ƒ sñt ‚ n  | j j d k rR| d	 7} | | j d t	 ƒ (t | | j
 j d ƒ s?t ‚ | j d t	 ƒ n  | d	 7} | j
 j d } | j | d t ƒt j |  j | j d t	 ƒ ƒ |  j |  j | ƒ ƒ ƒ s¾t ‚ t | | j
 j d ƒ |  j k sæt ‚ | d	 7} | j
 j d } | j |  j | ƒ d t ƒt j |  j | j d t	 ƒ ƒ |  j |  j | ƒ ƒ ƒ s[t ‚ t | | j
 j d ƒ |  j k sƒt ‚ | d	 7} | j
 j d } | j | j ƒ  d t	 ƒt j |  j | j d t	 ƒ ƒ |  j |  j | ƒ ƒ ƒ sõt ‚ t | | j
 j d ƒ |  j k st ‚ | d	 7} | j
 j d } | j |  j | j ƒ  ƒ d t	 ƒt j |  j | j d t	 ƒ ƒ |  j |  j | ƒ ƒ ƒ s˜t ‚ t | | j
 j d ƒ |  j k sÀt ‚ d
 S(   sÇ   
            We test that if the SharedVariable implement it we do inplace set_value
            We also test this for partial inplace modification when accessing the internal of theano.
            id   i   i   R   R   i    t
   csr_matrixR@   i   Ni   (   i   i   (   R   R	   R
   R   R   R   t   zerosR   R   R"   RA   t   storageR   RE   t   __name__RB   R   R!   R4   R   R   RJ   R   R   R   t   set_value_inplacet   set_cast_value_inplaceRI   (   R$   R   t   shpR&   R(   t   old_datat   nd(    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_inplace_set_value7  s`    	-'55*

!(
!(
!(
"?c         S` sÅ  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } t j | | j ƒ } | j | ƒ t j |  j | j d t ƒ ƒ |  j | ƒ ƒ sNt ‚ t j g  | j ƒ } | j j j ƒ  }	 t j j d k rt |	 ƒ d k sŸt ‚ t |	 d j t j j  ƒ sÁt ‚ t |	 d j t j j  ƒ sãt ‚ t |	 d j t j j! ƒ st ‚ n  t j g  | ƒ }
 t j" |  j |
 ƒ  ƒ |  j | ƒ k ƒ sJt ‚ |
 j j j ƒ  } t | ƒ d k stt ‚ t j g  | j ƒ } t j" | ƒ  | ƒ  k ƒ sªt ‚ | j j j ƒ  } t j j d k rt | ƒ d k sæt ‚ | d j t j# j$ j% k n  t j& j' r@t | j( t j& j) ƒ r@t* | d	 ƒ sqt ‚ n1 t j+ | j, ƒ  | ƒ } t j g  | ƒ } | ƒ  |
 ƒ  | j | ƒ |  j- t |
 ƒ t j j d k r±| ƒ  n |  j- t | ƒ d  S(   Ni   i   i   R   i   R   R0   i    t   sumt	   DebugModet
   DEBUG_MODE(   s   FAST_COMPILER\   R]   (.   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   t   specify_shapeR   RJ   R   R   R!   R"   R   R   R1   R2   R3   R5   R6   R7   R8   R9   R:   R;   R4   t   compilet   function_modulet   deep_copy_opt   sparset   enable_sparset   typet
   SparseTypet   hasattrt   gradR[   t   assertRaises(   R$   R   R%   t   x1_1t   x1_2t   x2t	   x1_sharedt   x1_specify_shapet   shape_op_fctR=   t   specify_shape_fctt   topo_specifyt   shape_constant_fctt   topo_cstt
   shape_gradt   shape_constant_fct_grad(    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_specify_shape‚  sZ    	***""%!
c         S` ss  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } t j | t j | j d ƒ | j d f ƒ } | j | ƒ t j |  j | j d t ƒ ƒ |  j | ƒ ƒ sht ‚ t j g  | j ƒ } | j j j ƒ  }	 | ƒ  t j j d k r)t |	 ƒ d	 k sÀt ‚ t |	 d j t j  j! ƒ sât ‚ t |	 d j t j  j! ƒ st ‚ t |	 d j t j  j" ƒ s)t ‚ n  t j g  | ƒ }
 |
 ƒ  t j# |  j |
 ƒ  ƒ |  j | ƒ k ƒ srt ‚ |
 j j j ƒ  } t j j d k r±t | ƒ d k s±t ‚ n  t j g  | j ƒ } t j# | ƒ  | ƒ  k ƒ sçt ‚ | j j j ƒ  } t j j d k r&t | ƒ d k s&t ‚ n  | j | ƒ |  j$ t |
 ƒ t j j d k r_| ƒ  n |  j$ t | ƒ d  S(   Ni   i   i   R   i   i    R   R0   i   R\   R]   (   s   FAST_COMPILEs	   DebugModes
   DEBUG_MODE(%   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R^   t   as_tensor_variableR   RJ   R   R   R!   R"   R   R   R1   R2   R3   R5   R6   R7   R8   R9   R:   R;   R4   Rh   (   R$   R   R%   Ri   Rj   Rk   Rl   Rm   Rn   R=   Ro   Rp   Rq   Rr   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_specify_shape_partialÄ  sV    	***	""%!
c         S` s  |  j  } | d  k r$ t j j } n  t j j t j	 ƒ  ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } t j
 | j d d d d g ƒ d | ƒ} |  j | ƒ } |  j | ƒ } t j d d | ƒ} |  j | ƒ } |  j | ƒ } t j g  d | t j | | ƒ | f g ƒ}	 |	 j j j ƒ  }
 |	 ƒ  t j j d k rÍt g  |
 D] } | j j j d k ^ qbƒ d k s’t ‚ t d
 „  |
 Dƒ ƒ s®t ‚ t d „  |
 Dƒ ƒ sÍt ‚ n  t j | | j d t ƒ j ƒ } t j g  | j d | t j | | ƒ | f g ƒ}	 |	 j j j ƒ  }
 |	 ƒ  } t j | d k ƒ sXt ‚ t j j d k rßt g  |
 D] } | j j j d k ^ qtƒ d k s¤t ‚ t d „  |
 Dƒ ƒ sÀt ‚ t d „  |
 Dƒ ƒ sßt ‚ n  t j | | j d t ƒ j ƒ } t j | | j d t ƒ j ƒ } t j g  | j d | t j | | ƒ | f g ƒ}	 |	 j j j ƒ  }
 |	 ƒ  } t j | d k ƒ s‹t ‚ t j j d k rt g  |
 D] } | j j j d k ^ q§ƒ d k s×t ‚ t d „  |
 Dƒ ƒ sót ‚ t d „  |
 Dƒ ƒ st ‚ n  d  S(   Ni   i   i(   R   t   updatesR0   t   Gemmt   GpuGemmt   StructuredDotc         s` s<   |  ]2 } t  | j t j j ƒ r | j t j j k Vq d  S(   N(   R7   R8   R   t   blasRy   t   gemm_inplace(   t   .0t   node(    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pys	   <genexpr>  s    c         s` s0   |  ]& } | j  j j d  k r | j  j Vq d S(   Rz   N(   R8   RE   RT   t   inplace(   R~   R   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pys	   <genexpr>  s    R   c         s` s<   |  ]2 } t  | j t j j ƒ r | j t j j k Vq d  S(   N(   R7   R8   R   R|   Ry   R}   (   R~   R   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pys	   <genexpr>(  s    c         s` s0   |  ]& } | j  j j d  k r | j  j Vq d S(   Rz   N(   R8   RE   RT   R€   (   R~   R   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pys	   <genexpr>)  s    c         s` s<   |  ]2 } t  | j t j j ƒ r | j t j j k Vq d  S(   N(   R7   R8   R   R|   Ry   R}   (   R~   R   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pys	   <genexpr>8  s    c         s` s0   |  ]& } | j  j j d  k r | j  j Vq d S(   Rz   N(   R8   RE   RT   R€   (   R~   R   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pys	   <genexpr>9  s    (   i(   i(   (   s   Gemms   GpuGemmR{   (   i(   i(   (   s   Gemms   GpuGemmR{   (   i(   i(   (   s   Gemms   GpuGemmR{   (    R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   RR   R   t   dotR1   R2   R3   R5   R[   R8   RE   RT   R   R4   R   R^   R!   R"   R   (   R$   R   R%   t   at   a_sharedt   bt   b_sharedt   st   s_sharedR<   R=   R   t   s_shared_specifyRW   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_specify_shape_inplace   s^    	**:!	:			:c         S` s”  |  j  } | d k r$ t j j } n  d } t j j t j	 ƒ  ƒ } xKt j
 | j | Œ  d | ƒt j | d | ƒg D]} | d k j ƒ  } |  j | ƒ } |  j | d t ƒ} | j ƒ  } | d | d	 | d
 <| d <|  j | ƒ } | j j | | ƒ st ‚ | j j | | ƒ s t ‚ | sv t j |  j | ƒ |  j | ƒ ƒ sQt ‚ | j j | | ƒ smt ‚ | j j | | ƒ sŒt ‚ qv qv Wd S(   s*    Test the type.values_eq[_approx] functioni   R   i    R   i   N(   i   i   (   i   i    (   i    i    (   i    i    (   i   i    (   R   R	   R
   R   R   R   R   R   R   R   R   t   randRR   R4   R   R   R"   RI   Rd   t	   values_eqR   t   values_eq_approxR   R   (   R$   R   RW   R%   R&   RR   R(   t   y(    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_values_eq:  s&    	+(   RT   t
   __module__t   staticmethodR   R   R#   RO   R   R    R   R   RK   RU   RV   RD   R   R   R/   R>   R?   RC   RH   RN   RP   RZ   Ru   Rw   R‰   RŽ   (    (   t   cast_value_t   dtype_t   get_value_borrow_true_alias_t   internal_type_t   op_by_matrix_t   ref_fct_t   set_cast_value_inplace_t   set_value_borrow_true_alias_t   set_value_inplace_t   shared_borrow_true_alias_t   shared_constructor_t"   shared_constructor_accept_ndarray_t   test_internal_type_t   theano_fct_(    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyR   @   s4   	1			&		1	!	K	B	<	:t   __qualname__(   t   unittestt   TestCaseR	   R   RT   Rf   RŸ   (   R›   R’   R“   Rš   R˜   R™   R—   Rœ   R”   R   Rž   R–   R‘   R•   t   nameR   (    (   R‘   R’   R“   R”   R•   R–   R—   R˜   R™   Rš   R›   Rœ   R   Rž   sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   makeSharedTester   s    1Fÿ ÿ 	R›   R’   R“   Rš   R˜   R™   R—   Rœ   R”   R   c         C` s   t  |  t j ƒ S(   N(   R7   R   t   ndarray(   R‚   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   <lambda>h  s    Rž   c         C` s   |  d S(   Ni   (    (   R‚   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyR¥   i  s    R–   c         C` s   t  j |  d ƒ S(   Ni   (   R   R   (   R‚   (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyR¥   j  s    R‘   R•   R¢   t   test_shared_optionsc           C` sE   t  j d d d d d t ƒ t  j d t j d ƒ d d d t ƒ d  S(   NRB   g        R¢   t   lkR   (   R
   t   sharedR"   R   t   float32(    (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   test_scalar_shared_optionsp  s    (   t
   __future__R    R   R   R   R    t   warningsR
   R   t   theano.testsR   R   t   theano.misc.may_share_memoryR   t   theano.sparset   seed_rngR   R   R	   R£   t   _sharedR   R   R"   R¤   R¦   Rª   (    (    (    sB   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_sharedvar.pyt   <module>   s>   
ÿ ÿ C							