class_docstr: Creates profiles in pprof format.
docstr: Get function that generates `ProfileDatum` objects.
  
  Returns:
    A function that generates `ProfileDatum` objects.
docstr_tok: ["Get","function","that","generates","`","ProfileDatum","`","objects",".","Returns",":","A","function","that","generates","`","ProfileDatum","`","objects","."]
code: def _get_profile_data_generator(self):
      """Get function that generates `ProfileDatum` objects.
  
      Returns:
        A function that generates `ProfileDatum` objects.
      """
      node_to_traceback = defaultdict(list)
      node_to_op_type = defaultdict(str)
      for op in self._graph.get_operations():
          node_to_traceback[op.name] = op.traceback
          node_to_op_type[op.name] = op.type
  
      def profile_data_generator(device_step_stats):
          for node_stats in device_step_stats.node_stats:
              if (
                  node_stats.node_name == "_SOURCE"
                  or node_stats.node_name == "_SINK"
              ):
                  continue
              yield ProfileDatum(
                  node_stats,
                  node_to_op_type[node_stats.node_name],
                  node_to_traceback[node_stats.node_name],
              )
  
      return profile_data_generator
  
imports: from collections import defaultdict
  from collections import namedtuple
  import gzip
  import os
  import string
  import sys
  import time
  from proto import profile_pb2
label_desc: Use image node_id 4 for calling the PprofProfiler obj's underlying member method code with example usage: obj._get_profile_data_generator() and returns: profile_data_generator