from tensorflow.python.util import compat

        update_str(n.name)
        update_str(n.op)
        update_strs(n.input)
        update_num(len(n.attr))
        # NOTE: protobuf map serialization does not guarantee ordering.
        for k in sorted(n.attr):
          update_str(k)
          update_str(n.attr[k].SerializeToString())

    _hash_func_def()
    # pylint: disable=protected-access
    self._sub_functions = temp_graph._functions
    for subname in sorted(self._sub_functions.keys()):
      hasher.update(compat.as_bytes(self._sub_functions[subname]._hash_str))
    # pylint: enable=protected-access

    # Uses the first 8 bytes sha1 hash digest as the __hash__.
    self._hash_str = hasher.hexdigest()[:8]
    self._hash = int(self._hash_str, 16)

    # Finally, we decide the function name to use.  If not specified,
    # make up something which is almost certainly unique.
    if not self._func_name:
      self._func_name = "_".join([_get_func_name(self._func), self._hash_str])
    self._definition.signature.name = self._func_name
    if self._func.__doc__:
