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: Implementation for the `decode_before_sum` method.
  
  The argument list of this method is different, to allow propagation of
  information about commutativity higher up the chain of encodings. For
  instance, consider an encoding consisting of three encoding stages, of which
  the first and third individually commute with sum. As a chain, the third
  stage does not commute with sum, because the second does not, and thus
  everything else after it.
  
  Args:
    encoded_tensors: See the `decode_before_sum` method.
    decode_params: See the `decode_before_sum` method.
    shape: See the `decode_before_sum` method.
    force_decode: If True, `self.stage.decode` will be called regardless of
      whether it commutes with sum or not.
  
  Returns:
    A structure as described in the `decode_before_sum` method.
docstr_tok: ["Implementation","for","the","`","decode_before_sum","`","method",".","The","argument","list","of","this","method","is","different",",","to","allow","propagation","of","information","about","commutativity","higher","up","the","chain","of","encodings",".","For","instance",",","consider","an","encoding","consisting","of","three","encoding","stages",",","of","which","the","first","and","third","individually","commute","with","sum",".","As","a","chain",",","the","third","stage","does","not","commute","with","sum",",","because","the","second","does","not",",","and","thus","everything","else","after","it",".","Args",":","encoded_tensors",":","See","the","`","decode_before_sum","`","method",".","decode_params",":","See","the","`","decode_before_sum","`","method",".","shape",":","See","the","`","decode_before_sum","`","method",".","force_decode",":","If","True",",","`","self.stage.decode","`","will","be","called","regardless","of","whether","it","commutes","with","sum","or","not",".","Returns",":","A","structure","as","described","in","the","`","decode_before_sum","`","method","."]
code: def _decode_before_sum_impl(
      self, encoded_tensors, decode_params, shape, force_decode
  ):
      """Implementation for the `decode_before_sum` method.
  
      The argument list of this method is different, to allow propagation of
      information about commutativity higher up the chain of encodings. For
      instance, consider an encoding consisting of three encoding stages, of which
      the first and third individually commute with sum. As a chain, the third
      stage does not commute with sum, because the second does not, and thus
      everything else after it.
  
      Args:
        encoded_tensors: See the `decode_before_sum` method.
        decode_params: See the `decode_before_sum` method.
        shape: See the `decode_before_sum` method.
        force_decode: If True, `self.stage.decode` will be called regardless of
          whether it commutes with sum or not.
  
      Returns:
        A structure as described in the `decode_before_sum` method.
      """
      temp_encoded_tensors = {}
      force_decode |= not self.stage.commutes_with_sum
      for key, value in six.iteritems(encoded_tensors):
          if key in self.children:
              with tf.compat.v1.name_scope(
                  None, "/".join([self.stage.name, key])
              ):
                  temp_encoded_tensors[key] = self.children[
                      key
                  ]._decode_before_sum_impl(  # pylint: disable=protected-access
                      value,
                      decode_params[EncoderKeys.CHILDREN][key],
                      shape[EncoderKeys.CHILDREN][key],
                      force_decode=force_decode,
                  )
          else:
              temp_encoded_tensors[key] = value
      if force_decode:
          # We explicitly provide num_summands=None as this is explicitly decoding
          # that happens *before* the sum.
          return self.stage.decode(
              temp_encoded_tensors,
              decode_params[EncoderKeys.PARAMS],
              num_summands=None,
              shape=shape[EncoderKeys.SHAPE],
          )
      else:
          return temp_encoded_tensors
  
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 16 for calling the Encoder obj's underlying member method code with example usage: obj._decode_before_sum_impl(encoded_tensors, decode_params, shape, force_decode) and returns: self, temp_encoded_tensors