class_docstr: A lightweight buffer for maintaining lists.
  
  The TensorBuffer accumulates tensors of the given shape into a tensor (whose
  rank is one more than that of the given shape) via calls to `append`. The
  current value of the accumulated tensor can be extracted via the property
  `values`.
docstr: Initializes the TensorBuffer.
  
  Args:
    capacity: Initial capacity. Buffer will double in capacity each time it is
      filled to capacity.
    shape: The shape (as tuple or list) of the tensors to accumulate.
    dtype: The type of the tensors.
    name: A string name for the variable_scope used.
  
  Raises:
    ValueError: If the shape is empty (specifies scalar shape).
docstr_tok: ["Initializes","the","TensorBuffer",".","Args",":","capacity",":","Initial","capacity",".","Buffer","will","double","in","capacity","each","time","it","is","filled","to","capacity",".","shape",":","The","shape","(","as","tuple","or","list",")","of","the","tensors","to","accumulate",".","dtype",":","The","type","of","the","tensors",".","name",":","A","string","name","for","the","variable_scope","used",".","Raises",":","ValueError",":","If","the","shape","is","empty","(","specifies","scalar","shape",")","."]
code: def __init__(self, capacity, shape, dtype=tf.int32, name=None):
      """Initializes the TensorBuffer.
  
      Args:
        capacity: Initial capacity. Buffer will double in capacity each time it is
          filled to capacity.
        shape: The shape (as tuple or list) of the tensors to accumulate.
        dtype: The type of the tensors.
        name: A string name for the variable_scope used.
  
      Raises:
        ValueError: If the shape is empty (specifies scalar shape).
      """
      shape = list(shape)
      self._rank = len(shape)
      self._name = name
      self._dtype = dtype
      if not self._rank:
          raise ValueError("Shape cannot be scalar.")
      shape = [capacity] + shape
  
      with tf.compat.v1.variable_scope(self._name):
          # We need to use a placeholder as the initial value to allow resizing.
          self._buffer = tf.Variable(
              initial_value=tf.placeholder_with_default(
                  tf.zeros(shape, dtype), shape=None
              ),
              trainable=False,
              name="buffer",
              use_resource=True,
          )
          self._current_size = tf.Variable(
              initial_value=0,
              dtype=tf.int32,
              trainable=False,
              name="current_size",
          )
          self._capacity = tf.Variable(
              initial_value=capacity,
              dtype=tf.int32,
              trainable=False,
              name="capacity",
          )
  
imports: import tensorflow.compat.v1
label_desc: Use image node_id 1 to create a new TensorBuffer object from inherited base classes: object with example: obj = TensorBuffer(capacity, shape, dtype, name)