<s> import sys <EOL> import numpy <EOL> import theano <EOL> import theano . tensor as tensor <EOL> from theano . tensor . blas_scipy import ScipyGer <EOL> from . test_blas import TestCase , gemm_no_inplace , TestBlasStrides <EOL> from theano . tests . unittest_tools import TestOptimizationMixin <EOL> class TestScipyGer ( TestCase , TestOptimizationMixin ) : <EOL> def setUp ( self ) : <EOL> self . mode = theano . compile . get_default_mode ( ) <EOL> self . mode = self . mode . including ( '<STR_LIT>' ) <EOL> self . mode = self . mode . excluding ( '<STR_LIT>' ) <EOL> dtype = self . dtype = '<STR_LIT>' <EOL> self . A = tensor . tensor ( dtype = dtype , broadcastable = ( False , False ) ) <EOL> self . a = tensor . tensor ( dtype = dtype , broadcastable = ( ) ) <EOL> self . x = tensor . tensor ( dtype = dtype , broadcastable = ( False , ) ) <EOL> self . y = tensor . tensor ( dtype = dtype , broadcastable = ( False , ) ) <EOL> self . Aval = numpy . ones ( ( <NUM_LIT:2> , <NUM_LIT:3> ) , dtype = dtype ) <EOL> self . xval = numpy . asarray ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , dtype = dtype ) <EOL> self . yval = numpy . asarray ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , dtype = dtype ) <EOL> if not theano . tensor . blas_scipy . have_fblas : <EOL> self . SkipTest ( ) <EOL> def function ( self , inputs , outputs ) : <EOL> return theano . function ( inputs , outputs , self . mode ) <EOL> def run_f ( self , f ) : <EOL> f ( self . Aval , self . xval , self . yval ) <EOL> f ( self . Aval [ : : - <NUM_LIT:1> , : : - <NUM_LIT:1> ] , self . xval [ : : - <NUM_LIT:1> ] , self . yval [ : : - <NUM_LIT:1> ] ) <EOL> def b ( self , bval ) : <EOL> return tensor . as_tensor_variable ( numpy . asarray ( bval , dtype = self . dtype ) ) <EOL> def test_outer ( self ) : <EOL> f = self . function ( [ self . x , self . y ] , tensor . outer ( self . x , self . y ) ) <EOL> self . assertFunctionContains ( f , ScipyGer ( destructive = True ) ) <EOL> def test_A_plus_outer ( self ) : <EOL> f = self . function ( [ self . A , self . x , self . y ] , <EOL> self . A + tensor . outer ( self . x , self . y ) ) <EOL> self . assertFunctionContains ( f , ScipyGer ( destructive = False ) ) <EOL> self . run_f ( f ) <EOL> def test_A_plus_scaled_outer ( self ) : <EOL> f = self . function ( [ self . A , self . x , self . y ] , <EOL> self . A + <NUM_LIT:0.1> * tensor . outer ( self . x , self . y ) ) <EOL> self . assertFunctionContains ( f , ScipyGer ( destructive = False ) ) <EOL> self . run_f ( f ) <EOL> def test_scaled_A_plus_scaled_outer ( self ) : <EOL> f = self . function ( [ self . A , self . x , self . y ] , <EOL> <NUM_LIT> * self . A + <NUM_LIT:0.1> * tensor . outer ( self . x , self . y ) ) <EOL> self . assertFunctionContains ( f , gemm_no_inplace ) <EOL> self . run_f ( f ) <EOL> class TestBlasStridesScipy ( TestBlasStrides ) : <EOL> mode = theano . compile . get_default_mode ( ) <EOL> mode = mode . including ( '<STR_LIT>' ) . excluding ( '<STR_LIT>' , '<STR_LIT>' ) </s>
