title: Error: module 'tensorflow._api.v2.train' has no attribute 'write_graph'
body: <p>I used tensorflow 2.8 but I have a problem.
  My function</p>
  <pre><code>def export_model(saver, model, input_node_names, output_node_name,MODEL_NAME):
  tf.train.write_graph(K.get_session().graph_def, 'out', \
                       MODEL_NAME + '_graph.pbtxt')
  saver.save(K.get_session(), 'out/' + MODEL_NAME + '.chkp')
  freeze_graph.freeze_graph('out/' + MODEL_NAME + '_graph.pbtxt', None, \
                            False, 'out/' + MODEL_NAME + '.chkp', output_node_name, \
                            &quot;save/restore_all&quot;, &quot;save/Const:0&quot;, \
                            'out/modelim' + MODEL_NAME + '.pb', True, &quot;&quot;)
  input_graph_def = tf.GraphDef()
  with tf.gfile.Open('out/modelim' + MODEL_NAME + '.pb', &quot;rb&quot;) as f:
      input_graph_def.ParseFromString(f.read())
  output_graph_def = optimize_for_inference_lib.optimize_for_inference(
      input_graph_def, input_node_names, [output_node_name],
      tf.float32.as_datatype_enum)
  with tf.gfile.FastGFile('out/opt_' + MODEL_NAME + '.pb', &quot;wb&quot;) as f:
      f.write(output_graph_def.SerializeToString())
  print(&quot;graph kaydedildi&quot;)
  return
  </code></pre>
  <p>I try export</p>
  <pre><code>export_model(tf.compat.v1.train.Saver(), estimator, [inputName], outPutName,&quot;test&quot;)
  </code></pre>
  <p>but ı have a problem
  module 'tensorflow._api.v2.train' has no attribute 'write_graph'</p>