class_docstr: Tests the `PrintModelAnalysisHook` hook
class_docstr_tok: ["Tests","the","`","PrintModelAnalysisHook","`","hook"]
code: def test_begin(self):
      model_dir = tempfile.mkdtemp()
      outfile = tempfile.NamedTemporaryFile()
      tf.get_variable("weigths", [128, 128])
      hook = hooks.PrintModelAnalysisHook(
          params={},
          model_dir=model_dir,
          run_config=tf.contrib.learn.RunConfig(),
      )
      hook.begin()
  
      with gfile.GFile(
          os.path.join(model_dir, "model_analysis.txt")
      ) as file:
          file_contents = file.read().strip()
  
      self.assertEqual(
          file_contents.decode(),
          "_TFProfRoot (--/16.38k params)\n"
          "  weigths (128x128, 16.38k/16.38k params)",
      )
      outfile.close()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import os
  import tempfile
  import shutil
  import time
  import tensorflow
  from tensorflow.python.training import monitored_session
  from tensorflow import gfile
  from seq2seq import graph_utils
  from seq2seq.training import hooks
label_desc: Use image node_id 1 for calling the TestPrintModelAnalysisHook obj's underlying member method code with example usage: obj.test_begin() without return types