#NEWLINE# def _is_const( z , val , approx = False ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# maybe = opt . get_scalar_constant_value ( z ) #NEWLINE# #UNINDENT# except tensor . NotScalarConstantError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if approx : #NEWLINE# #INDENT# return numpy . allclose ( maybe , val ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return numpy . all ( ( maybe == val ) )