class_docstr: Sequence of ndarrays having variable first dimension sizes.
  
  This is a container that can store multiple ndarrays where each ndarray
  might have a different first dimension size but a *common* size for the
  remaining dimensions.
  
  More generally, an instance of :class:`ArraySequence` of length $N$ is
  composed of $N$ ndarrays of shape $(d_1, d_2, ... d_D)$ where $d_1$
  can vary in length between arrays but $(d_2, ..., d_D)$ have to be the
  same for every ndarray.
class_docstr_tok: ["Sequence","of","ndarrays","having","variable","first","dimension","sizes",".","This","is","a","container","that","can","store","multiple","ndarrays","where","each","ndarray","might","have","a","different","first","dimension","size","but","a","*","common","*","size","for","the","remaining","dimensions",".","More","generally",",","an","instance","of",":","class",":","`","ArraySequence","`","of","length","$","N","$","is","composed","of","$","N","$","ndarrays","of","shape","$","(","d_1",",","d_2",",","...","d_D",")","$","where","$","d_1","$","can","vary","in","length","between","arrays","but","$","(","d_2",",","...",",","d_D",")","$","have","to","be","the","same","for","every","ndarray","."]
docstr: Initialize array sequence instance
  
  Parameters
  ----------
  iterable : None or iterable or :class:`ArraySequence`, optional
      If None, create an empty :class:`ArraySequence` object.
      If iterable, create a :class:`ArraySequence` object initialized
      from array-like objects yielded by the iterable.
      If :class:`ArraySequence`, create a view (no memory is allocated).
      For an actual copy use :meth:`.copy` instead.
  buffer_size : float, optional
      Size (in Mb) for memory allocation when `iterable` is a generator.
docstr_tok: ["Initialize","array","sequence","instance","Parameters","--","--","--","--","--","iterable",":","None","or","iterable","or",":","class",":","`","ArraySequence","`",",","optional","If","None",",","create","an","empty",":","class",":","`","ArraySequence","`","object",".","If","iterable",",","create","a",":","class",":","`","ArraySequence","`","object","initialized","from","array-like","objects","yielded","by","the","iterable",".","If",":","class",":","`","ArraySequence","`",",","create","a","view","(","no","memory","is","allocated",")",".","For","an","actual","copy","use",":","meth",":","`",".copy","`","instead",".","buffer_size",":","float",",","optional","Size","(","in","Mb",")","for","memory","allocation","when","`","iterable","`","is","a","generator","."]
code: def __init__(self, iterable=None, buffer_size=4):
      """Initialize array sequence instance
  
      Parameters
      ----------
      iterable : None or iterable or :class:`ArraySequence`, optional
          If None, create an empty :class:`ArraySequence` object.
          If iterable, create a :class:`ArraySequence` object initialized
          from array-like objects yielded by the iterable.
          If :class:`ArraySequence`, create a view (no memory is allocated).
          For an actual copy use :meth:`.copy` instead.
      buffer_size : float, optional
          Size (in Mb) for memory allocation when `iterable` is a generator.
      """
      # Create new empty `ArraySequence` object.
      self._is_view = False
      self._data = np.array([])
      self._offsets = np.array([], dtype=np.intp)
      self._lengths = np.array([], dtype=np.intp)
      self._buffer_size = buffer_size
      self._build_cache = None
  
      if iterable is None:
          return
  
      if is_array_sequence(iterable):
          # Create a view.
          self._data = iterable._data
          self._offsets = iterable._offsets
          self._lengths = iterable._lengths
          self._is_view = True
          return
  
      self.extend(iterable)
  
imports: import numbers
  from functools import reduce
  from operator import mul
  import numpy
label_desc: Use image node_id 1 to create a new ArraySequence object  with example: obj = ArraySequence(iterable, buffer_size)