\"%size\n",
210 | " return strip_def\n",
211 | "\n",
212 | "def show_graph(graph_def, max_const_size=32):\n",
213 | " \"\"\"Visualize tensorflow graph.\"\"\"\n",
214 | " if hasattr(graph_def, 'as_graph_def'):\n",
215 | " graph_def = graph_def.as_graph_def()\n",
216 | " strip_def = strip_consts(graph_def, max_const_size=max_const_size)\n",
217 | " code = \"\"\"\n",
218 | " \n",
222 | " \n",
223 | " \n",
224 | " \n",
225 | "
\n",
226 | " \"\"\".format(data=repr(str(strip_def)), id='graph'+str(np.random.rand()))\n",
227 | " \n",
228 | " iframe = \"\"\"\"\"\".format(code.replace('\"', '"'))\n",
229 | " display(HTML(iframe))"
230 | ]
231 | },
232 | {
233 | "cell_type": "code",
234 | "execution_count": 31,
235 | "metadata": {},
236 | "outputs": [
237 | {
238 | "data": {
239 | "text/html": [
240 | ""
250 | ],
251 | "text/plain": [
252 | ""
253 | ]
254 | },
255 | "metadata": {},
256 | "output_type": "display_data"
257 | }
258 | ],
259 | "source": [
260 | "show_graph(tf.get_default_graph())"
261 | ]
262 | }
263 | ],
264 | "metadata": {
265 | "kernelspec": {
266 | "display_name": "Python 3",
267 | "language": "python",
268 | "name": "python3"
269 | },
270 | "language_info": {
271 | "codemirror_mode": {
272 | "name": "ipython",
273 | "version": 3
274 | },
275 | "file_extension": ".py",
276 | "mimetype": "text/x-python",
277 | "name": "python",
278 | "nbconvert_exporter": "python",
279 | "pygments_lexer": "ipython3",
280 | "version": "3.6.6"
281 | }
282 | },
283 | "nbformat": 4,
284 | "nbformat_minor": 2
285 | }
286 |
--------------------------------------------------------------------------------