<s> from __future__ import absolute_import , print_function , division <EOL> import numpy as np <EOL> from numpy . testing import assert_equal , assert_string_equal <EOL> import theano <EOL> import theano . tensor as tt <EOL> import theano . tests . unittest_tools as utt <EOL> from theano . tensor import ( Subtensor , AdvancedSubtensor , AdvancedSubtensor1 , <EOL> IncSubtensor , AdvancedIncSubtensor , <EOL> AdvancedIncSubtensor1 ) <EOL> def test_numpy_method ( ) : <EOL> x = tt . dmatrix ( '<STR_LIT:x>' ) <EOL> data = np . random . rand ( <NUM_LIT:5> , <NUM_LIT:5> ) <EOL> x . tag . test_value = data <EOL> for fct in [ np . arccos , np . arccosh , np . arcsin , np . arcsinh , <EOL> np . arctan , np . arctanh , np . ceil , np . cos , np . cosh , np . deg2rad , <EOL> np . exp , np . exp2 , np . expm1 , np . floor , np . log , <EOL> np . log10 , np . log1p , np . log2 , np . rad2deg , <EOL> np . sin , np . sinh , np . sqrt , np . tan , np . tanh , np . trunc ] : <EOL> y = fct ( x ) <EOL> f = theano . function ( [ x ] , y ) <EOL> utt . assert_allclose ( np . nan_to_num ( f ( data ) ) , <EOL> np . nan_to_num ( fct ( data ) ) ) <EOL> def test_copy ( ) : <EOL> x = tt . dmatrix ( '<STR_LIT:x>' ) <EOL> data = np . random . rand ( <NUM_LIT:5> , <NUM_LIT:5> ) <EOL> y = x . copy ( name = '<STR_LIT:y>' ) <EOL> f = theano . function ( [ x ] , y ) <EOL> assert_equal ( f ( data ) , data ) <EOL> assert_string_equal ( y . name , '<STR_LIT:y>' ) <EOL> def test_None_dimShuffle_replace ( ) : <EOL> x = tt . dmatrix ( '<STR_LIT:x>' ) <EOL> y = x [ : , None , : ] <EOL> f = theano . function ( [ x ] , y ) <EOL> for elem in f . maker . fgraph . toposort ( ) : <EOL> assert type ( elem . op ) not in [ Subtensor , AdvancedSubtensor , <EOL> AdvancedSubtensor1 , IncSubtensor , <EOL> AdvancedIncSubtensor , <EOL> AdvancedIncSubtensor1 ] <EOL> x = tt . tensor3 ( '<STR_LIT:x>' ) <EOL> y1 = x [ : , : , None , : ] <EOL> y2 = x [ None , : , : , None , : ] <EOL> y3 = x [ : , : , None , : , None , None ] <EOL> f = theano . function ( [ x ] , [ y1 , y2 , y3 ] ) <EOL> for elem in f . maker . fgraph . toposort ( ) : <EOL> assert type ( elem . op ) not in [ Subtensor , AdvancedSubtensor , <EOL> AdvancedSubtensor1 , IncSubtensor , <EOL> AdvancedIncSubtensor , <EOL> AdvancedIncSubtensor1 ] </s>
