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: Appends all `elements` to this array sequence.
  
  Parameters
  ----------
  elements : iterable of ndarrays or :class:`ArraySequence` object
      If iterable of ndarrays, each ndarray will be concatenated along
      the first dimension then appended to the data of this
      ArraySequence.
      If :class:`ArraySequence` object, its data are simply appended to
      the data of this ArraySequence.
  
  Returns
  -------
  None
  
  Notes
  -----
  The shape of the elements to be added must match the one of the data of
  this :class:`ArraySequence` except for the first dimension.
docstr_tok: ["Appends","all","`","elements","`","to","this","array","sequence",".","Parameters","--","--","--","--","--","elements",":","iterable","of","ndarrays","or",":","class",":","`","ArraySequence","`","object","If","iterable","of","ndarrays",",","each","ndarray","will","be","concatenated","along","the","first","dimension","then","appended","to","the","data","of","this","ArraySequence",".","If",":","class",":","`","ArraySequence","`","object",",","its","data","are","simply","appended","to","the","data","of","this","ArraySequence",".","Returns","--","--","--","-","None","Notes","--","--","-","The","shape","of","the","elements","to","be","added","must","match","the","one","of","the","data","of","this",":","class",":","`","ArraySequence","`","except","for","the","first","dimension","."]
code: def extend(self, elements):
      """Appends all `elements` to this array sequence.
  
      Parameters
      ----------
      elements : iterable of ndarrays or :class:`ArraySequence` object
          If iterable of ndarrays, each ndarray will be concatenated along
          the first dimension then appended to the data of this
          ArraySequence.
          If :class:`ArraySequence` object, its data are simply appended to
          the data of this ArraySequence.
  
      Returns
      -------
      None
  
      Notes
      -----
      The shape of the elements to be added must match the one of the data of
      this :class:`ArraySequence` except for the first dimension.
      """
      # If possible try pre-allocating memory.
      try:
          iter_len = len(elements)
      except TypeError:
          pass
      else:  # We do know the iterable length
          if iter_len == 0:
              return
          e0 = np.asarray(elements[0])
          n_elements = np.sum([len(e) for e in elements])
          self._build_cache = _BuildCache(self, e0.shape[1:], e0.dtype)
          self._resize_data_to(
              self._get_next_offset() + n_elements, self._build_cache
          )
  
      for e in elements:
          self.append(e, cache_build=True)
  
      self.finalize_append()
  
imports: import numbers
  from functools import reduce
  from operator import mul
  import numpy
label_desc: Use image node_id 13 for calling the ArraySequence obj's underlying member method code with example usage: obj.extend(elements) without return types