def shaped_arange(shape, xp=cupy, dtype=numpy.float32):
 a = numpy.arange(1, (internal.prod(shape) + 1), 1)
 if (numpy.dtype(dtype).type == numpy.bool_):
  return xp.array(((a % 2) == 0).reshape(shape))
 else:
  return xp.array(a.astype(dtype).reshape(shape))

def shaped_arange ( shape , xp = cupy , dtype = numpy . float32 ) : a = numpy . arange ( 1 , ( internal . prod ( shape ) + 1 ) , 1 ) if ( numpy . dtype ( dtype ) . type == numpy . bool_ ) : return xp . array ( ( ( a % 2 ) == 0 ) . reshape ( shape ) ) else : return xp . array ( a . astype ( dtype ) . reshape ( shape ) )
returns an array with given shape .