def extract_constant(x, elemwise=True, only_process_constants=False):
 try:
  x = get_scalar_constant_value(x, elemwise, only_process_constants)
 except NotScalarConstantError:
  pass
 if (isinstance(x, scal.ScalarVariable) or isinstance(x, scal.sharedvar.ScalarSharedVariable)):
  if (x.owner and isinstance(x.owner.op, ScalarFromTensor)):
   x = x.owner.inputs[0]
  else:
   x = tensor_from_scalar(x)
 return x

def extract_constant ( x , elemwise = True , only_process_constants = False ) : try : x = get_scalar_constant_value ( x , elemwise , only_process_constants ) except NotScalarConstantError : pass if ( isinstance ( x , scal . ScalarVariable ) or isinstance ( x , scal . sharedvar . ScalarSharedVariable ) ) : if ( x . owner and isinstance ( x . owner . op , ScalarFromTensor ) ) : x = x . owner . inputs [ 0 ] else : x = tensor_from_scalar ( x ) return x
extract the constant value of symbol from code if the name symbol is bound to a constant value by the python code object code .