#NEWLINE# def test_active( self ) : #NEWLINE# #INDENT# a = np . array ( [ [ 1.0 , 2 ] , [ 0 , 0 ] , [ ( - 1 ) , ( - 2 ) ] ] ) #NEWLINE# standard = np . array ( [ [ 0.7310585786300049 , 0.8807970779778823 ] , [ 0.5 , 0.5 ] , [ 0.2689414213699951 , 0.11920292202211755 ] ] ) #NEWLINE# a_sgmoid = active . active ( a ) #NEWLINE# self . assertEqual ( is_matrix_equals ( self , standard ) , True ) #NEWLINE# a_linear = active . active ( a , 'linear' ) #NEWLINE# self . assertEqual ( is_matrix_equals ( a_linear , a ) , True ) #NEWLINE# a = np . array ( [ [ 0.1 , ( - 0.2 ) ] , [ 0 , 10 ] ] ) #NEWLINE# standard = np . array ( [ [ 0.0996679946249559 , ( - 0.197375320224904 ) ] , [ 0 , 0.9999999958776926 ] ] ) #NEWLINE# a_tanh = active . active ( a , 'tanh' ) #NEWLINE# self . assertTrue ( is_matrix_equals ( a_tanh , standard ) ) #NEWLINE# standard = np . array ( [ [ 0.1 , 0 ] , [ 0 , 10 ] ] ) #NEWLINE# a_rel = active . active ( a , 'relu' ) #NEWLINE# self . assertTrue ( is_matrix_equals ( a_rel , standard ) ) #NEWLINE# with self . assertRaises ( Exception ) : #NEWLINE# #INDENT# active . active ( a , 'unknown active_type' )