#NEWLINE# def ensure_float( val , default , name ) : #NEWLINE# #INDENT# if ( val is None ) : #NEWLINE# #INDENT# return default . clone ( ) #NEWLINE# #UNINDENT# if ( not isinstance ( val , Variable ) ) : #NEWLINE# #INDENT# val = constant ( val ) #NEWLINE# #UNINDENT# if ( hasattr ( val , 'ndim' ) and ( val . ndim == 0 ) ) : #NEWLINE# #INDENT# val = as_scalar ( val ) #NEWLINE# #UNINDENT# if ( not isinstance ( val . type , theano . scalar . Scalar ) ) : #NEWLINE# #INDENT# raise TypeError ( ( '%s: expected a scalar value' % ( name , ) ) ) #NEWLINE# #UNINDENT# if ( not ( val . type . dtype == 'float32' ) ) : #NEWLINE# #INDENT# raise TypeError ( ( '%s: type is not float32' % ( name , ) ) ) #NEWLINE# #UNINDENT# return val