code: def pack_into_int(value, input_bitrange, target_bitrange):
      """Pack integers in range [0, 2**`input_bitrange`-1] into integer values.
  
      This utility simply concatenates the relevant bits of the input values into
      a sequence of integer values.
  
      The `target_bitrange` can be used to not use all bits of the return type.
      This can be useful for instance when the resulting values can be serialized as
      a varint. In such case, using only 7 bits per byte could be more desirable.
  
      NOTE: This only uses basic math operations to implement the bit manipulation,
      not any bitwise operations, which is relevant in environments where only a
      subset of TensorFlow ops/kernels are available. Moreover, if values outside of
      the expected range are provided at runtime, an error will *not* be raised.
      The behavior of this method in such case is undefined.
  
      Args:
        value: An integer Tensor to be packed.
        input_bitrange: An integer. The number of relevant bits in `value`.
        target_bitrange: An integer. The number of bits to be used in packed
          representation.
  
      Returns:
        An integer Tensor representing `value` of the same dtype as `value`.
      """
      # TODO(b/161433177): Provide a general solution without memory overhead.
      # Special cases implemented without extra memory overhead.
      if input_bitrange == 6 and target_bitrange == 28:
          return _pack_into_int_6_28(value)
      if input_bitrange == 7 and target_bitrange == 28:
          return _pack_into_int_7_28(value)
      if input_bitrange == 8 and target_bitrange == 28:
          return _pack_into_int_8_28(value)
      if input_bitrange == 12 and target_bitrange == 28:
          return _pack_into_int_12_28(value)
  
      # General solution with possible extra memory overhead.
      logging.warning(
          "This code path can temporarily allocate extra memory. If "
          "memory footprint is a problem, consider different bitpacking"
          " method or turning this functionality off. See b/161433177"
      )
      if input_bitrange > 1:
          value = tf.reshape(value, [-1, 1])
          value = _expand_to_binary_form(value, input_bitrange)
      return _pack_binary_form(value, target_bitrange)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import math
  import numpy
  import tensorflow
label_desc: Use image node_id 7 for calling a global function with example usage: pack_into_int(value, input_bitrange, target_bitrange) and returns: _pack_binary_form, _pack_into_int_6_28, _pack_into_int_7_28, _pack_into_int_8_28, _pack_into_int_12_28