<s> from theano . tensor . xlogx import xlogx , xlogy0 <EOL> import unittest <EOL> import theano <EOL> from theano . tensor import as_tensor_variable <EOL> from . import test_basic as TT <EOL> import random <EOL> import numpy . random <EOL> from theano . tests import unittest_tools as utt <EOL> class T_XlogX ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> utt . seed_rng ( ) <EOL> def test0 ( self ) : <EOL> x = as_tensor_variable ( [ <NUM_LIT:1> , <NUM_LIT:0> ] ) <EOL> y = xlogx ( x ) <EOL> f = theano . function ( [ ] , [ y ] ) <EOL> self . assertTrue ( numpy . all ( f ( ) == numpy . asarray ( [ <NUM_LIT:0> , <NUM_LIT:0.> ] ) ) ) <EOL> def test1 ( self ) : <EOL> utt . verify_grad ( xlogx , [ numpy . random . rand ( <NUM_LIT:3> , <NUM_LIT:4> ) ] ) <EOL> class T_XlogY0 ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> utt . seed_rng ( ) <EOL> def test2 ( self ) : <EOL> utt . verify_grad ( xlogy0 , [ numpy . random . rand ( <NUM_LIT:3> , <NUM_LIT:4> ) , numpy . random . rand ( <NUM_LIT:3> , <NUM_LIT:4> ) ] ) <EOL> def test3 ( self ) : <EOL> x = as_tensor_variable ( [ <NUM_LIT:1> , <NUM_LIT:0> ] ) <EOL> y = as_tensor_variable ( [ <NUM_LIT:1> , <NUM_LIT:0> ] ) <EOL> z = xlogy0 ( x , y ) <EOL> f = theano . function ( [ ] , z ) <EOL> self . assertTrue ( numpy . all ( f ( ) == numpy . asarray ( [ <NUM_LIT:0> , <NUM_LIT:0.> ] ) ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
