def _asfarray(x):
 if (hasattr(x, 'dtype') and (x.dtype.char in numpy.typecodes['AllFloat'])):
  if (x.dtype == numpy.half):
   return numpy.asarray(x, dtype=numpy.float32)
  return numpy.asarray(x, dtype=x.dtype)
 else:
  ret = numpy.asarray(x)
  if (ret.dtype == numpy.half):
   return numpy.asarray(ret, dtype=numpy.float32)
  elif (ret.dtype.char not in numpy.typecodes['AllFloat']):
   return numpy.asfarray(x)
  return ret

def _asfarray ( x ) : if ( hasattr ( x , 'dtype' ) and ( x . dtype . char in numpy . typecodes [ 'AllFloat' ] ) ) : if ( x . dtype == numpy . half ) : return numpy . asarray ( x , dtype = numpy . float32 ) return numpy . asarray ( x , dtype = x . dtype ) else : ret = numpy . asarray ( x ) if ( ret . dtype == numpy . half ) : return numpy . asarray ( ret , dtype = numpy . float32 ) elif ( ret . dtype . char not in numpy . typecodes [ 'AllFloat' ] ) : return numpy . asfarray ( x ) return ret
like numpy asfarray .