#NEWLINE# def test_log_softmax2( self ) : #NEWLINE# #INDENT# if ( dnn . version ( ) < 3000 ) : #NEWLINE# #INDENT# raise SkipTest ( 'Log-softmax is only in cudnn v3+' ) #NEWLINE# #UNINDENT# x = T . fmatrix ( ) #NEWLINE# f_ref = theano . function ( [ x ] , T . nnet . LogSoftmax ( ) ( x ) ) #NEWLINE# log_softmax_out = T . nnet . LogSoftmax ( ) ( x ) #NEWLINE# f = theano . function ( [ x ] , log_softmax_out , mode = mode_with_gpu ) #NEWLINE# dnn_softmax_nodes = [ x for n in f . maker . fgraph . toposort ( ) if isinstance ( n . op , dnn . GpuDnnSoftmax ) ] #NEWLINE# assert ( len ( dnn_softmax_nodes ) == 1 ) #NEWLINE# assert ( dnn_softmax_nodes [ 0 ] . op . algo == 'log' ) #NEWLINE# inp = numpy . random . normal ( 0 , 1 , ( 5 , 6 ) ) . astype ( 'float32' ) #NEWLINE# utt . assert_allclose ( f ( inp ) , f_ref ( inp ) ) #NEWLINE# log_softmax_out = T . log ( T . nnet . Softmax ( ) ( x ) ) #NEWLINE# f = theano . function ( [ x ] , log_softmax_out , mode = mode_with_gpu ) #NEWLINE# dnn_softmax_nodes = [ n for n in f . maker . fgraph . toposort ( ) if isinstance ( n . op , dnn . GpuDnnSoftmax ) ] #NEWLINE# assert ( len ( dnn_softmax_nodes ) == 1 ) #NEWLINE# assert ( dnn_softmax_nodes [ 0 ] . op . algo == 'log' ) #NEWLINE# inp = numpy . random . normal ( 0 , 1 , ( 5 , 6 ) ) . astype ( 'float32' ) #NEWLINE# utt . assert_allclose ( f ( inp ) , f_ref ( inp ) )