def get_numeric_types(with_int=True, with_float=True, with_complex=False, only_theano_types=True):
 if only_theano_types:
  theano_types = [d.dtype for d in theano.scalar.all_types]
 rval = []
 def is_within(cls1, cls2):
  return ((cls1 is cls2) or issubclass(cls1, cls2) or isinstance(numpy.array([0], dtype=cls1)[0], cls2))
 for cls in get_numeric_subclasses():
  dtype = numpy.dtype(cls)
  if (((not with_complex) and is_within(cls, numpy.complexfloating)) or ((not with_int) and is_within(cls, numpy.integer)) or ((not with_float) and is_within(cls, numpy.floating)) or (only_theano_types and (dtype not in theano_types))):
   continue
  rval.append([str(dtype), dtype, dtype.num])
 return [x[1] for x in sorted(rval, key=str)]

def get_numeric_types ( with_int = True , with_float = True , with_complex = False , only_theano_types = True ) : if only_theano_types : theano_types = [ d . dtype for d in theano . scalar . all_types ] rval = [ ] def is_within ( cls1 , cls2 ) : return ( ( cls1 is cls2 ) or issubclass ( cls1 , cls2 ) or isinstance ( numpy . array ( [ 0 ] , dtype = cls1 ) [ 0 ] , cls2 ) ) for cls in get_numeric_subclasses ( ) : dtype = numpy . dtype ( cls ) if ( ( ( not with_complex ) and is_within ( cls , numpy . complexfloating ) ) or ( ( not with_int ) and is_within ( cls , numpy . integer ) ) or ( ( not with_float ) and is_within ( cls , numpy . floating ) ) or ( only_theano_types and ( dtype not in theano_types ) ) ) : continue rval . append ( [ str ( dtype ) , dtype , dtype . num ] ) return [ x [ 1 ] for x in sorted ( rval , key = str ) ]
return numpy numeric data types .