ó
àÆ÷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 „  Z d „  Z d „  Z d S(   i    (   t   absolute_importt   print_functiont   divisionN(   t   tensor(   t*   crossentropy_softmax_argmax_1hot_with_biasc          C` sw   t  j d ƒ }  t j |  g t  j t  j |  d j d g ƒ |  d ƒ d ƒ ƒ } t | t j	 d d d ƒd ƒ ƒ d  S(	   Nt   yi    t   xi   i   t   dtypet   int64i   (
   R   t   lvectort   theanot   functiont   int_divt
   DimShufflet   broadcastablet   printt   numpyt   ones(   R   t   f(    (    s=   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_misc.pyt   test_bug_2009_06_02_trac_387
   s
    /c          C` s  t  j j ƒ  }  t  j j ƒ  } t  j |  | g t  j t  j j |  | ƒ d t ƒƒ } t j d
 ƒ } t j	 d ƒ } | | | ƒ } t
 | ƒ | j d ƒ t
 | | | ƒ ƒ t
 | ƒ t j j | ƒ d k sÓ t ‚ t  j j ƒ  } t  j j ƒ  } t  j j ƒ  } t | | | ƒ }	 |	 d }
 t  j | | | g t  j |
 d t ƒƒ } t j d ƒ }  t j	 d ƒ } t j d d t j ƒ} | |  | | ƒ } t j | ƒ } t | ƒ } t
 d | f ƒ d |  d <t | |  | | ƒ ƒ } t
 d | f ƒ | | k sÿt ‚ | | k j ƒ  st ‚ d	 S(   s?   Regression test for a bug where output was borrowed by mistake.t   borrowi   i   i   i    R   s   Output z after first call: %ss   Output z after second call: %sN(   i   i   (   i   i   (   i   i   (   i    i    (   R
   R   t   dmatrixR   t   Outt   dott   FalseR   t   zerosR   R   t   fillt   linalgt   normt   AssertionErrort   dvectort   ivectorR   t   int32t   copyt   idt   all(   t   at   bt   gR   R   t   zt   test_output_activation_no_biast   test_b2t   test_targett   nll_softmax_argmaxt   outputt   ct   z_backupt   id_zt   id_other(    (    s=   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_misc.pyt#   test_bug_2009_07_17_borrowed_output   sD    '


	

c          C` sA   t  j t j ƒ  ƒ }  |  j j t j d d |  j ƒd t	 ƒd  S(   Ni   R   t   strict(   i   i   (
   R!   t   deepcopyR   t   matrixt   typet   filterR   R   R   t   True(   R$   (    (    s=   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_misc.pyt   test_deepcopied_type_filterL   s    	(   t
   __future__R    R   R   R!   t   sysR   R
   R   t   theano.tensor.nnetR   R   R1   R8   (    (    (    s=   /tmp/pip-build-X4mzal/theano/theano/tensor/tests/test_misc.pyt   <module>   s   	
	8