class_docstr: Class for composing and creating `Encoder`.
  
  This class is a utility for separating the creation of the `Encoder` from its
  intended functionality. Each instance of `EncoderComposer` corresponds to a
  node in a tree of encoding stages to be used for encoding.
  
  The `make` method converts this object to an `Encoder`, which exposes the
  encoding functionality.
docstr: Adds a parent node.
  
  Args:
    stage: An `EncodingStageInterface` or an `AdaptiveEncodingStageInterface`.
    key: `string`, specifying the output key of `stage` to be further encoded
      by the encoding stage controlled by this object.
  
  Returns:
    An `EncoderComposer`, the newly created parent node.
  
  Raises:
    KeyError: If `key` is not a compressible tensor of `stage`.
docstr_tok: ["Adds","a","parent","node",".","Args",":","stage",":","An","`","EncodingStageInterface","`","or","an","`","AdaptiveEncodingStageInterface","`",".","key",":","`","string","`",",","specifying","the","output","key","of","`","stage","`","to","be","further","encoded","by","the","encoding","stage","controlled","by","this","object",".","Returns",":","An","`","EncoderComposer","`",",","the","newly","created","parent","node",".","Raises",":","KeyError",":","If","`","key","`","is","not","a","compressible","tensor","of","`","stage","`","."]
code: def add_parent(self, stage, key):
      """Adds a parent node.
  
      Args:
        stage: An `EncodingStageInterface` or an `AdaptiveEncodingStageInterface`.
        key: `string`, specifying the output key of `stage` to be further encoded
          by the encoding stage controlled by this object.
  
      Returns:
        An `EncoderComposer`, the newly created parent node.
  
      Raises:
        KeyError: If `key` is not a compressible tensor of `stage`.
      """
      if key not in stage.compressible_tensors_keys:
          raise KeyError(
              "The specified key is either not compressible or not "
              "returned by the encoding stage."
          )
      new_builder = EncoderComposer(stage)
      new_builder._children[
          key
      ] = self  # pylint: disable=protected-access
      return new_builder
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import six
  import tensorflow
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.core import encoding_stage
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.utils import py_utils
label_desc: Use image node_id 3 for calling the EncoderComposer obj's underlying member method code with example usage: obj.add_parent(stage, key) and returns: new_builder