class_docstr: Tests for NodeFileWriter.
docstr: Gets new NodeDefs written by the NodeFileWriter.
  
  Returns:
    A list of new NodeDefs in the file written by NodeDefWriter since the last
    time this method was called.
docstr_tok: ["Gets","new","NodeDefs","written","by","the","NodeFileWriter",".","Returns",":","A","list","of","new","NodeDefs","in","the","file","written","by","NodeDefWriter","since","the","last","time","this","method","was","called","."]
code: def _get_new_node_defs(self):
      """Gets new NodeDefs written by the NodeFileWriter.
  
      Returns:
        A list of new NodeDefs in the file written by NodeDefWriter since the last
        time this method was called.
      """
      node_def_bytes = self.node_file.read()
      node_defs = []
      cur_pos = 0
      while cur_pos < len(node_def_bytes):
          size_bytes = node_def_bytes[cur_pos : cur_pos + 8]
          (size,) = struct.unpack("<Q", size_bytes)
          cur_pos += 8
          node_def = node_def_pb2.NodeDef()
          node_def.ParseFromString(
              node_def_bytes[cur_pos : cur_pos + size]
          )
          # When running eager op as function is enabled we expect these extra nodes
          # to show up in the list of executed nodes.
          ignored_ops = []
          if context.run_eager_op_as_function_enabled():
              ignored_ops.extend(["_Arg", "_Retval", "NoOp"])
              # TODO(b/206047926): Fix or remove _Recv/_HostRecv from the ignored_ops.
              ignored_ops.extend(["_Recv", "_HostRecv"])
          if node_def.op not in ignored_ops:
              node_defs.append(node_def)
          cur_pos += size
      self.assertEqual(cur_pos, len(node_def_bytes))
      return node_defs
  
imports: import io
  import os
  import struct
  import tempfile
  import numpy
  from tensorflow.core.framework import node_def_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.framework import test_util
  from tensorflow.python.framework.test_util import IsMklEnabled
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.ops import gen_math_ops
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 5 for calling the NodeFileWriterTest obj's underlying member method code with example usage: obj._get_new_node_defs() and returns: node_defs