From f425ccf3e461ee3b0ee8bbddb228c50d2e83a639 Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Thu, 7 May 2020 17:24:45 +0100
Subject: [PATCH] [Notebook] import showInNetron from utils for cnv-w1a1
 notebook

---
 .../end2end_example/cnv_end2end_example.ipynb   | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/notebooks/end2end_example/cnv_end2end_example.ipynb b/notebooks/end2end_example/cnv_end2end_example.ipynb
index a00db3275..eda58eebf 100644
--- a/notebooks/end2end_example/cnv_end2end_example.ipynb
+++ b/notebooks/end2end_example/cnv_end2end_example.ipynb
@@ -50,26 +50,17 @@
     "There is an additional section for functional verification (red section) on the left side of the diagram, which we will not cover in this notebook. For details please take a look in the verification notebook which you can find [here](tfc_end2end_verification.ipynb)\n",
     "\n",
     "\n",
-    "This Jupyter notebook is organized based on the sections described above. We will use the following helper functions, `showSrc` to show source code of FINN library calls and `showInNetron` to show the ONNX model at the current transformation step. The Netron displays are interactive, but they only work when running the notebook actively and not on GitHub (i.e. if you are viewing this on GitHub you'll only see blank squares)."
+    "We will use the helper function `showInNetron` to show the ONNX model at the current transformation step. The Netron displays are interactive, but they only work when running the notebook actively and not on GitHub (i.e. if you are viewing this on GitHub you'll only see blank squares)."
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [],
    "source": [
-    "import inspect\n",
-    "import netron\n",
     "from finn.util.basic import make_build_dir\n",
-    "from IPython.display import IFrame\n",
-    "\n",
-    "def showSrc(what):\n",
-    "    print(\"\".join(inspect.getsourcelines(what)[0]))\n",
-    "    \n",
-    "def showInNetron(model_filename):\n",
-    "    netron.start(model_filename, port=8081, host=\"0.0.0.0\")\n",
-    "    return IFrame(src=\"http://0.0.0.0:8081/\", width=\"100%\", height=400)\n",
+    "from finn.util.visualization import showInNetron\n",
     "    \n",
     "build_dir = \"/workspace/finn\""
    ]
@@ -151,7 +142,7 @@
        "        "
       ],
       "text/plain": [
-       "<IPython.lib.display.IFrame at 0x7f0cb10a8ef0>"
+       "<IPython.lib.display.IFrame at 0x7f7b24ef8b00>"
       ]
      },
      "execution_count": 3,
-- 
GitLab