#NEWLINE# def test_migrad( ) : #NEWLINE# #INDENT# sess = tf . Session ( ) #NEWLINE# x = tf . Variable ( np . float64 ( 2 ) , name = 'x' ) #NEWLINE# sess . run ( tf . initialize_variables ( [ x ] ) ) #NEWLINE# optimizer = MigradOptimizer ( session = sess ) #NEWLINE# results = optimizer . minimize ( [ x ] , ( x ** 2 ) , [ ( 2 * x ) ] ) #NEWLINE# assert results . success #NEWLINE# results = optimizer . minimize ( [ x ] , ( x ** 2 ) ) #NEWLINE# assert results . success #NEWLINE# @ raises ( ValueError ) #NEWLINE# def test_illegal_parameter_as_variable1( ) : #NEWLINE# #INDENT# optimizer . minimize ( [ 42 ] , ( x ** 2 ) ) #NEWLINE# #UNINDENT# test_illegal_parameter_as_variable1 ( ) #NEWLINE# @ raises ( ValueError ) #NEWLINE# def test_illegal_parameter_as_variable2( ) : #NEWLINE# #INDENT# optimizer . minimize ( 42 , ( x ** 2 ) ) #NEWLINE# #UNINDENT# test_illegal_parameter_as_variable2 ( )