class_docstr: Class for composing individual encoding stages.
  
  This class provides functionality for arbitrarily composing individual
  encoding stages (implementations of `EncodingStageInterface` or
  `AdaptiveEncodingStageInterface`) into a tree, where an output `Tensor` of an
  encoding stage can be further encoded by another encoding stage.
  
  The interface is similar to that of `AdaptiveEncodingStageInterface`, with the
  additional methods `decode_before_sum` and `decode_after_sum`. These methods
  split the decoding functionality to two parts, based on commutativity with
  summation.
  
  Similar to the `AdaptiveEncodingStageInterface`, the methods are designed to
  be functional transformations. That means, for instance, that the
  `initial_state` and `update_state` methods do not modify any underlying state.
  Rather, the user of the `Encoder` class is responsible for storing any values
  if necessary, and providing them back to appropriate methods of this class.
docstr: Encodes a given `Tensor`.
  
  Args:
    x: A `Tensor`, input to be encoded.
    encode_params: A dictionary, containing the parameters needed for the
      encoding. The structure needs to be the return structure of the
      `get_params` method.
    name: `string`, name of the operation.
  
  Returns:
    A tuple `(encoded_tensors, state_update_tensors, input_shapes)`, where
    these are:
    `encoded_tensors`: A dictionary of `Tensor` objects representing the
      encoded input `x`.
    `state_update_tensors`: A dictionary of `Tensor` objects representing
      information necessary for updating the state. The dictionary has two
      keys: `EncoderKeys.TENSORS` and `EncoderKeys.CHILDREN`. The
      `EncoderKeys.TENSORS` key maps to the state_update_tensors produced by
      `self.stage`. The `EncoderKeys.CHILDREN` key maps to a dictionary with
      the same keys as `self.children`, each of which maps to an object like
      this one, recursively.
    'input_shapes': A dictionary of the shapes of inputs to individual
      encoding stages. The dictionary has two keys: `EncoderKeys.SHAPE` and
      `EncoderKeys.CHILDREN`. The `EncoderKeys.SHAPE` key maps to the shape of
      the input to `self.stage`. The `EncoderKeys.CHILDREN` key maps to a
      dictionary with the same keys as `self.children`, each of which maps to
      an object like this one, recursively. The values at the leaves of this
      dictionary can be either `Tensor` objects, non-TensorFlow constants such
      as a `list` or numpy value, or `None`, if the shape is not needed.
docstr_tok: ["Encodes","a","given","`","Tensor","`",".","Args",":","x",":","A","`","Tensor","`",",","input","to","be","encoded",".","encode_params",":","A","dictionary",",","containing","the","parameters","needed","for","the","encoding",".","The","structure","needs","to","be","the","return","structure","of","the","`","get_params","`","method",".","name",":","`","string","`",",","name","of","the","operation",".","Returns",":","A","tuple","`","(","encoded_tensors",",","state_update_tensors",",","input_shapes",")","`",",","where","these","are",":","`","encoded_tensors","`",":","A","dictionary","of","`","Tensor","`","objects","representing","the","encoded","input","`","x","`",".","`","state_update_tensors","`",":","A","dictionary","of","`","Tensor","`","objects","representing","information","necessary","for","updating","the","state",".","The","dictionary","has","two","keys",":","`","EncoderKeys.TENSORS","`","and","`","EncoderKeys.CHILDREN","`",".","The","`","EncoderKeys.TENSORS","`","key","maps","to","the","state_update_tensors","produced","by","`","self.stage","`",".","The","`","EncoderKeys.CHILDREN","`","key","maps","to","a","dictionary","with","the","same","keys","as","`","self.children","`",",","each","of","which","maps","to","an","object","like","this","one",",","recursively",".","'input_shapes","'",":","A","dictionary","of","the","shapes","of","inputs","to","individual","encoding","stages",".","The","dictionary","has","two","keys",":","`","EncoderKeys.SHAPE","`","and","`","EncoderKeys.CHILDREN","`",".","The","`","EncoderKeys.SHAPE","`","key","maps","to","the","shape","of","the","input","to","`","self.stage","`",".","The","`","EncoderKeys.CHILDREN","`","key","maps","to","a","dictionary","with","the","same","keys","as","`","self.children","`",",","each","of","which","maps","to","an","object","like","this","one",",","recursively",".","The","values","at","the","leaves","of","this","dictionary","can","be","either","`","Tensor","`","objects",",","non-TensorFlow","constants","such","as","a","`","list","`","or","numpy","value",",","or","`","None","`",",","if","the","shape","is","not","needed","."]
code: def encode(self, x, encode_params, name=None):
      """Encodes a given `Tensor`.
  
      Args:
        x: A `Tensor`, input to be encoded.
        encode_params: A dictionary, containing the parameters needed for the
          encoding. The structure needs to be the return structure of the
          `get_params` method.
        name: `string`, name of the operation.
  
      Returns:
        A tuple `(encoded_tensors, state_update_tensors, input_shapes)`, where
        these are:
        `encoded_tensors`: A dictionary of `Tensor` objects representing the
          encoded input `x`.
        `state_update_tensors`: A dictionary of `Tensor` objects representing
          information necessary for updating the state. The dictionary has two
          keys: `EncoderKeys.TENSORS` and `EncoderKeys.CHILDREN`. The
          `EncoderKeys.TENSORS` key maps to the state_update_tensors produced by
          `self.stage`. The `EncoderKeys.CHILDREN` key maps to a dictionary with
          the same keys as `self.children`, each of which maps to an object like
          this one, recursively.
        'input_shapes': A dictionary of the shapes of inputs to individual
          encoding stages. The dictionary has two keys: `EncoderKeys.SHAPE` and
          `EncoderKeys.CHILDREN`. The `EncoderKeys.SHAPE` key maps to the shape of
          the input to `self.stage`. The `EncoderKeys.CHILDREN` key maps to a
          dictionary with the same keys as `self.children`, each of which maps to
          an object like this one, recursively. The values at the leaves of this
          dictionary can be either `Tensor` objects, non-TensorFlow constants such
          as a `list` or numpy value, or `None`, if the shape is not needed.
      """
      with tf.compat.v1.name_scope(
          name, "encoder_encode", [x] + tf.nest.flatten(encode_params)
      ):
          return self._encode_impl(x, encode_params)
  
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 12 for calling the Encoder obj's underlying member method code with example usage: obj.encode(x, encode_params, name) and returns: self