def arange(*args, **kwargs):
 if (len(args) == 1):
  start = 0
  stop = args[0]
  step = 1
 elif (len(args) == 2):
  start = args[0]
  stop = args[1]
  step = 1
 elif (len(args) == 3):
  (start, stop, step) = args
 else:
  raise TypeError('\n        arange takes 3 positional arguments: arange([start], stop, [step])\n        ')
 if ('chunks' not in kwargs):
  raise ValueError('Must supply a chunks= keyword argument')
 chunks = kwargs['chunks']
 dtype = kwargs.get('dtype', None)
 if (dtype is None):
  dtype = np.arange(0, 1, step).dtype
 num = max(np.ceil(((stop - start) / step)), 0)
 chunks = normalize_chunks(chunks, (num,))
 name = ('arange-' + tokenize((start, stop, step, chunks, num)))
 dsk = {}
 elem_count = 0
 for (i, bs) in enumerate(chunks[0]):
  blockstart = (start + (elem_count * step))
  blockstop = (start + ((elem_count + bs) * step))
  task = (chunk.arange, blockstart, blockstop, step, bs, dtype)
  dsk[(name, i)] = task
  elem_count += bs
 return Array(dsk, name, chunks, dtype=dtype)

def arange ( * args , ** kwargs ) : if ( len ( args ) == 1 ) : start = 0 stop = args [ 0 ] step = 1 elif ( len ( args ) == 2 ) : start = args [ 0 ] stop = args [ 1 ] step = 1 elif ( len ( args ) == 3 ) : ( start , stop , step ) = args else : raise TypeError ( '\n        arange takes 3 positional arguments: arange([start], stop, [step])\n        ' ) if ( 'chunks' not in kwargs ) : raise ValueError ( 'Must supply a chunks= keyword argument' ) chunks = kwargs [ 'chunks' ] dtype = kwargs . get ( 'dtype' , None ) if ( dtype is None ) : dtype = np . arange ( 0 , 1 , step ) . dtype num = max ( np . ceil ( ( ( stop - start ) / step ) ) , 0 ) chunks = normalize_chunks ( chunks , ( num , ) ) name = ( 'arange-' + tokenize ( ( start , stop , step , chunks , num ) ) ) dsk = { } elem_count = 0 for ( i , bs ) in enumerate ( chunks [ 0 ] ) : blockstart = ( start + ( elem_count * step ) ) blockstop = ( start + ( ( elem_count + bs ) * step ) ) task = ( chunk . arange , blockstart , blockstop , step , bs , dtype ) dsk [ ( name , i ) ] = task elem_count += bs return Array ( dsk , name , chunks , dtype = dtype )
creates a 1-d tensor containing a sequence of integers .