class_docstr: Encoding stage for bitpacking values into an integer type.
  
  This class performs a lossless transformation, and realizes representation
  savings.
  
  The encode method expects integer values in range `[0, 2**input_bits-1]` in a
  floating point type (`tf.float32` or `tf.float64`). It packs the values to
  `tf.int32` type, and returns a rank 1 `Tensor` of packed values. The packed
  values are in the range `[0, 2**28-1]`, as the serialization in protocol
  buffer for this type is varint, and this thus ensures every element fits into
  4 bytes.
class_docstr_tok: ["Encoding","stage","for","bitpacking","values","into","an","integer","type",".","This","class","performs","a","lossless","transformation",",","and","realizes","representation","savings",".","The","encode","method","expects","integer","values","in","range","`","[","0",",","2","*","*","input_bits-1","]","`","in","a","floating","point","type","(","`","tf.float32","`","or","`","tf.float64","`",")",".","It","packs","the","values","to","`","tf.int32","`","type",",","and","returns","a","rank","1","`","Tensor","`","of","packed","values",".","The","packed","values","are","in","the","range","`","[","0",",","2","*","*","28-1","]","`",",","as","the","serialization","in","protocol","buffer","for","this","type","is","varint",",","and","this","thus","ensures","every","element","fits","into","4","bytes","."]
docstr: See base class.
code: def decode(
      self,
      encoded_tensors,
      decode_params,
      num_summands=None,
      shape=None,
  ):
      """See base class."""
      del decode_params, num_summands  # Unused.
      unpacked_x = tf_utils.unpack_from_int(
          encoded_tensors[self.ENCODED_VALUES_KEY],
          self._input_bits,
          self._target_bitrange,
          shape,
      )
  
      dummy_type_value = encoded_tensors.get(self.DUMMY_TYPE_VALUES_KEY)
      if dummy_type_value is not None:
          return tf.cast(unpacked_x, dummy_type_value.dtype)
      else:
          return tf.cast(unpacked_x, tf.float32)
  
imports: import collections
  import numpy
  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 tf_utils
label_desc: Use image node_id 8 for calling the BitpackingEncodingStage obj's underlying member method code with example usage: obj.decode(encoded_tensors, decode_params, num_summands, shape) and returns: tf, tf