diff --git a/tf-graph/tf-graph-basic.build.html b/tf-graph/tf-graph-basic.build.html index 786d07a..e860c58 100644 --- a/tf-graph/tf-graph-basic.build.html +++ b/tf-graph/tf-graph-basic.build.html @@ -1053,4 +1053,13 @@

[[title]]

- + +
+ +
+ + diff --git a/tf-graph/tf-graph-basic.build.js b/tf-graph/tf-graph-basic.build.js index b7168ae..43e0da9 100644 --- a/tf-graph/tf-graph-basic.build.js +++ b/tf-graph/tf-graph-basic.build.js @@ -38447,7 +38447,7 @@ return this.disabled || !this.required || this.required && this.value; Polymer({ is: 'tf-graph-controls', ready: function () { -d3.select(this.$['summary-icon']).attr('xlink:href', '/files/tf-graph/summary-icon.svg'); +d3.select(this.$['summary-icon']).attr('xlink:href', 'summary-icon.svg'); }, properties: { hasStats: { type: Boolean }, diff --git a/tfutils.py b/tfutils.py index a436495..4a4990f 100644 --- a/tfutils.py +++ b/tfutils.py @@ -1,12 +1,14 @@ import tensorflow as tf +from tensorflow.core.framework import graph_pb2 import numpy as np +from base64 import b64encode from IPython.display import clear_output, Image, display, HTML def graph_as_HTML(graph_def, baseURL=''): # Helper functions for TF Graph visualization def _strip_consts(graph_def, max_const_size=32): """Strip large constant values from graph_def.""" - strip_def = tf.GraphDef() + strip_def = graph_pb2.GraphDef() for n0 in graph_def.node: n = strip_def.node.add() n.MergeFrom(n0) @@ -31,24 +33,13 @@ def _show_entire_graph(graph_def, max_const_size=32): """Visualize TensorFlow graph.""" 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 = """ - - -
- -
- """.format(data=repr(str(strip_def)), id='graph' + str(np.random.rand()), baseURL=baseURL) - - iframe = """ - - """.format(code.replace('"', '"')) - - return iframe + strip_def = strip_consts(graph_def, max_const_size=max_const_size) + data = b64encode(str(strip_def).encode()).decode() + id = str(np.random.rand()) + page = "https://raw.githack.com/AnotherGroupChat/Machine-Learning/dmadisetti-patch-1/tf-graph/tf-graph-basic.build.html" + return f""" + + """ # Visualizing the network graph. Be sure expand the "mixed" nodes to see their # internal structure. We are going to visualize "Conv2D" nodes.