class_docstr: Buffer for processors which need context to do their processing.
  
  Parameters
  ----------
  buffer_size : int or tuple
      Size of the buffer (time steps, [additional dimensions]).
  init : numpy array, optional
      Init the buffer with this array.
  init_value : float, optional
      If only `buffer_size` is given but no `init`, use this value to
      initialise the buffer.
  
  Notes
  -----
  If `buffer_size` (or the first item thereof in case of tuple) is 1,
  only the un-buffered current value is returned.
  
  If context is needed, `buffer_size` must be set to >1.
  E.g. SpectrogramDifference needs a context of two frames to be able to
  compute the difference between two consecutive frames.
class_docstr_tok: ["Buffer","for","processors","which","need","context","to","do","their","processing",".","Parameters","--","--","--","--","--","buffer_size",":","int","or","tuple","Size","of","the","buffer","(","time","steps",",","[","additional","dimensions","]",")",".","init",":","numpy","array",",","optional","Init","the","buffer","with","this","array",".","init_value",":","float",",","optional","If","only","`","buffer_size","`","is","given","but","no","`","init","`",",","use","this","value","to","initialise","the","buffer",".","Notes","--","--","-","If","`","buffer_size","`","(","or","the","first","item","thereof","in","case","of","tuple",")","is","1",",","only","the","un-buffered","current","value","is","returned",".","If","context","is","needed",",","`","buffer_size","`","must","be","set","to",">","1",".","E.g",".","SpectrogramDifference","needs","a","context","of","two","frames","to","be","able","to","compute","the","difference","between","two","consecutive","frames","."]
code: def __init__(self, buffer_size=None, init=None, init_value=0):
      # if init is given, infer buffer_size from it
      if buffer_size is None and init is not None:
          buffer_size = init.shape
      # if buffer_size is int, make a tuple
      elif isinstance(buffer_size, integer_types):
          buffer_size = (buffer_size,)
      # TODO: use np.pad for fancy initialisation (can be done in process())
      # init buffer if needed
      if buffer_size is not None and init is None:
          init = np.ones(buffer_size) * init_value
      # save variables
      self.buffer_size = buffer_size
      self.init = init
      self.data = init
  
imports: from __future__ import absolute_import, division, print_function
  import argparse
  import itertools
  import multiprocessing
  import os
  import sys
  from collections.abc import MutableSequence
  import numpy
  from .utils import integer_types
label_desc: Use image node_id 1 to create a new BufferProcessor object from inherited base classes: Processor with example: obj = BufferProcessor(buffer_size, init, init_value)