code: def graph(graph_def, max_const_size=32):
      
      if hasattr(graph_def, 'as_graph_def'):
          graph_def = graph_def.as_graph_def()
      strip_def = _strip_consts(graph_def, max_const_size=max_const_size)
      code = """
          <script>
            function load() {{
              document.getElementById("{id}").pbtxt = {data};
            }}
          </script>
          <link rel="import" href="https://tensorboard.appspot.com/tf-graph-basic.build.html" onload=load()>
          <div style="height:600px">
            <tf-graph-basic id="{id}"></tf-graph-basic>
          </div>
      """.format(data=repr(str(strip_def)), id='graph'+str(np.random.rand()))
  
      iframe = """
          <iframe seamless style="width:100%; height:620px; border: none;" srcdoc="{}"></iframe>
      """.format(code.replace('"', '&quot;'))
      _display_html(iframe)
docs: Visualize a TensorFlow graph.
  
      This function was originally found in this notebook (also Apache licensed):
      https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb