From 744772e0b4a9c67845b7cd2f11c6b7e91f7dd686 Mon Sep 17 00:00:00 2001 From: auphelia <jakobapk@web.de> Date: Wed, 6 May 2020 17:04:55 +0100 Subject: [PATCH] [Notebook] Rename internals folder into advanced and integrate new utility functions --- .../0_custom_analysis_pass.ipynb | 30 ++++------------ .../1_custom_transformation_pass.ipynb | 32 +++++------------- .../im2col_finnhlslib.PNG | Bin 3 files changed, 15 insertions(+), 47 deletions(-) rename notebooks/{internals => advanced}/0_custom_analysis_pass.ipynb (90%) rename notebooks/{internals => advanced}/1_custom_transformation_pass.ipynb (93%) rename notebooks/{internals => advanced}/im2col_finnhlslib.PNG (100%) diff --git a/notebooks/internals/0_custom_analysis_pass.ipynb b/notebooks/advanced/0_custom_analysis_pass.ipynb similarity index 90% rename from notebooks/internals/0_custom_analysis_pass.ipynb rename to notebooks/advanced/0_custom_analysis_pass.ipynb index ce95f1297..4be8e5928 100644 --- a/notebooks/internals/0_custom_analysis_pass.ipynb +++ b/notebooks/advanced/0_custom_analysis_pass.ipynb @@ -17,10 +17,7 @@ "metadata": {}, "outputs": [], "source": [ - "import inspect\n", - "\n", - "def showSrc(what):\n", - " print(\"\".join(inspect.getsourcelines(what)[0]))" + "from finn.util.visualization import showSrc, showInNetron" ] }, { @@ -53,19 +50,6 @@ "cell_type": "code", "execution_count": 2, "metadata": {}, - "outputs": [], - "source": [ - "import netron\n", - "from IPython.display import IFrame\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)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, "outputs": [ { "name": "stdout", @@ -88,10 +72,10 @@ " " ], "text/plain": [ - "<IPython.lib.display.IFrame at 0x7f34317f1278>" + "<IPython.lib.display.IFrame at 0x7ff8c03ac438>" ] }, - "execution_count": 3, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -109,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -126,7 +110,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -156,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -183,7 +167,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [ { diff --git a/notebooks/internals/1_custom_transformation_pass.ipynb b/notebooks/advanced/1_custom_transformation_pass.ipynb similarity index 93% rename from notebooks/internals/1_custom_transformation_pass.ipynb rename to notebooks/advanced/1_custom_transformation_pass.ipynb index 8e19bc7a0..d6d78270b 100644 --- a/notebooks/internals/1_custom_transformation_pass.ipynb +++ b/notebooks/advanced/1_custom_transformation_pass.ipynb @@ -17,10 +17,7 @@ "metadata": {}, "outputs": [], "source": [ - "import inspect\n", - "\n", - "def showSrc(what):\n", - " print(\"\".join(inspect.getsourcelines(what)[0]))" + "from finn.util.visualization import showSrc, showInNetron" ] }, { @@ -163,19 +160,6 @@ "cell_type": "code", "execution_count": 5, "metadata": {}, - "outputs": [], - "source": [ - "import netron\n", - "from IPython.display import IFrame\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)" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, "outputs": [ { "name": "stdout", @@ -198,10 +182,10 @@ " " ], "text/plain": [ - "<IPython.lib.display.IFrame at 0x7f57cafc5c88>" + "<IPython.lib.display.IFrame at 0x7f9a1e9fcac8>" ] }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -212,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -249,7 +233,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -259,7 +243,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -285,10 +269,10 @@ " " ], "text/plain": [ - "<IPython.lib.display.IFrame at 0x7f57e15781d0>" + "<IPython.lib.display.IFrame at 0x7f9a34fff3c8>" ] }, - "execution_count": 10, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } diff --git a/notebooks/internals/im2col_finnhlslib.PNG b/notebooks/advanced/im2col_finnhlslib.PNG similarity index 100% rename from notebooks/internals/im2col_finnhlslib.PNG rename to notebooks/advanced/im2col_finnhlslib.PNG -- GitLab