Skip to content

Instantly share code, notes, and snippets.

@ArthurDelannoyazerty
Created September 4, 2025 14:20
Show Gist options
  • Select an option

  • Save ArthurDelannoyazerty/97e7b427bffdefc3d3d774642b8e738a to your computer and use it in GitHub Desktop.

Select an option

Save ArthurDelannoyazerty/97e7b427bffdefc3d3d774642b8e738a to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "code",
"source": [
"import torch\n",
"import torch.nn as nn\n",
"from torchview import draw_graph"
],
"metadata": {
"id": "ymgFTiY_CqTj"
},
"execution_count": 3,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"id": "D7xtSSInCop-"
},
"outputs": [],
"source": [
"class SimpleCNN(nn.Module):\n",
" def __init__(self):\n",
" super(SimpleCNN, self).__init__()\n",
" self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)\n",
" self.relu1 = nn.ReLU()\n",
" self.pool1 = nn.MaxPool2d(kernel_size=2, stride=2)\n",
" self.conv2 = nn.Conv2d(16, 32, kernel_size=3, padding=1)\n",
" self.relu2 = nn.ReLU()\n",
" self.pool2 = nn.MaxPool2d(kernel_size=2, stride=2)\n",
" self.fc = nn.Linear(32 * 8 * 8, 10)\n",
"\n",
" def forward(self, x):\n",
" x = self.pool1(self.relu1(self.conv1(x)))\n",
" x = self.pool2(self.relu2(self.conv2(x)))\n",
" x = x.view(-1, 32 * 8 * 8)\n",
" x = self.fc(x)\n",
" return x"
]
},
{
"cell_type": "code",
"source": [
"!mkdir datafolder"
],
"metadata": {
"id": "fPp78yKoF-cI"
},
"execution_count": 32,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Instantiate the model\n",
"model = SimpleCNN()\n",
"\n",
"# Visualize the model\n",
"# device='meta' allows for visualization without moving the model to a specific device\n",
"model_graph = draw_graph(model, input_size=(1, 3, 32, 32), device='meta', graph_name='SimpleCNN')\n",
"model_graph.visual_graph.render('simple_cnn_graph', directory='datafolder/', format='png', cleanup=True)\n",
"model_graph.visual_graph"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 997
},
"id": "zyJjMJ1eCve6",
"outputId": "67029a66-6c50-4722-b8f9-37c9d29abf3a"
},
"execution_count": 34,
"outputs": [
{
"output_type": "execute_result",
"data": {
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.43.0 (0)\n -->\n<!-- Title: SimpleCNN Pages: 1 -->\n<svg width=\"239pt\" height=\"732pt\"\n viewBox=\"0.00 0.00 239.00 732.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 728)\">\n<title>SimpleCNN</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-728 235,-728 235,4 -4,4\"/>\n<!-- 0 -->\n<g id=\"node1\" class=\"node\">\n<title>0</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"204.5,-724 26.5,-724 26.5,-692 204.5,-692 204.5,-724\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"26.5,-692 26.5,-724 109.5,-724 109.5,-692 26.5,-692\"/>\n<text text-anchor=\"start\" x=\"31.5\" y=\"-711\" font-family=\"Linux libertine\" font-size=\"10.00\">input&#45;tensor</text>\n<text text-anchor=\"start\" x=\"46.5\" y=\"-700\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"109.5,-692 109.5,-724 204.5,-724 204.5,-692 109.5,-692\"/>\n<text text-anchor=\"start\" x=\"114.5\" y=\"-705.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32)</text>\n</g>\n<!-- 1 -->\n<g id=\"node2\" class=\"node\">\n<title>1</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"225,-656 6,-656 6,-614 225,-614 225,-656\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"6.5,-614 6.5,-656 59.5,-656 59.5,-614 6.5,-614\"/>\n<text text-anchor=\"start\" x=\"14.5\" y=\"-638\" font-family=\"Linux libertine\" font-size=\"10.00\">Conv2d</text>\n<text text-anchor=\"start\" x=\"11.5\" y=\"-627\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"59.5,-635 59.5,-656 118.5,-656 118.5,-635 59.5,-635\"/>\n<text text-anchor=\"start\" x=\"70.5\" y=\"-643\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"118.5,-635 118.5,-656 225.5,-656 225.5,-635 118.5,-635\"/>\n<text text-anchor=\"start\" x=\"126.5\" y=\"-643\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"59.5,-614 59.5,-635 118.5,-635 118.5,-614 59.5,-614\"/>\n<text text-anchor=\"start\" x=\"64.5\" y=\"-622\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"118.5,-614 118.5,-635 225.5,-635 225.5,-614 118.5,-614\"/>\n<text text-anchor=\"start\" x=\"123.5\" y=\"-622\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 16, 32, 32) </text>\n</g>\n<!-- 0&#45;&gt;1 -->\n<g id=\"edge1\" class=\"edge\">\n<title>0&#45;&gt;1</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-691.94C115.5,-684.45 115.5,-675.12 115.5,-666.24\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-666.16 115.5,-656.16 112,-666.16 119,-666.16\"/>\n</g>\n<!-- 2 -->\n<g id=\"node3\" class=\"node\">\n<title>2</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"225,-578 6,-578 6,-536 225,-536 225,-578\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"6.5,-536 6.5,-578 59.5,-578 59.5,-536 6.5,-536\"/>\n<text text-anchor=\"start\" x=\"20.5\" y=\"-560\" font-family=\"Linux libertine\" font-size=\"10.00\">ReLU</text>\n<text text-anchor=\"start\" x=\"11.5\" y=\"-549\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"59.5,-557 59.5,-578 118.5,-578 118.5,-557 59.5,-557\"/>\n<text text-anchor=\"start\" x=\"70.5\" y=\"-565\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"118.5,-557 118.5,-578 225.5,-578 225.5,-557 118.5,-557\"/>\n<text text-anchor=\"start\" x=\"123.5\" y=\"-565\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 16, 32, 32) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"59.5,-536 59.5,-557 118.5,-557 118.5,-536 59.5,-536\"/>\n<text text-anchor=\"start\" x=\"64.5\" y=\"-544\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"118.5,-536 118.5,-557 225.5,-557 225.5,-536 118.5,-536\"/>\n<text text-anchor=\"start\" x=\"123.5\" y=\"-544\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 16, 32, 32) </text>\n</g>\n<!-- 1&#45;&gt;2 -->\n<g id=\"edge2\" class=\"edge\">\n<title>1&#45;&gt;2</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-613.63C115.5,-605.82 115.5,-596.73 115.5,-588.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-588.16 115.5,-578.16 112,-588.16 119,-588.16\"/>\n</g>\n<!-- 3 -->\n<g id=\"node4\" class=\"node\">\n<title>3</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"231,-500 0,-500 0,-458 231,-458 231,-500\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"0.5,-458 0.5,-500 65.5,-500 65.5,-458 0.5,-458\"/>\n<text text-anchor=\"start\" x=\"5.5\" y=\"-482\" font-family=\"Linux libertine\" font-size=\"10.00\">MaxPool2d</text>\n<text text-anchor=\"start\" x=\"11.5\" y=\"-471\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"65.5,-479 65.5,-500 124.5,-500 124.5,-479 65.5,-479\"/>\n<text text-anchor=\"start\" x=\"76.5\" y=\"-487\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"124.5,-479 124.5,-500 231.5,-500 231.5,-479 124.5,-479\"/>\n<text text-anchor=\"start\" x=\"129.5\" y=\"-487\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 16, 32, 32) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"65.5,-458 65.5,-479 124.5,-479 124.5,-458 65.5,-458\"/>\n<text text-anchor=\"start\" x=\"70.5\" y=\"-466\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"124.5,-458 124.5,-479 231.5,-479 231.5,-458 124.5,-458\"/>\n<text text-anchor=\"start\" x=\"129.5\" y=\"-466\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 16, 16, 16) </text>\n</g>\n<!-- 2&#45;&gt;3 -->\n<g id=\"edge3\" class=\"edge\">\n<title>2&#45;&gt;3</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-535.63C115.5,-527.82 115.5,-518.73 115.5,-510.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-510.16 115.5,-500.16 112,-510.16 119,-510.16\"/>\n</g>\n<!-- 4 -->\n<g id=\"node5\" class=\"node\">\n<title>4</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"225,-422 6,-422 6,-380 225,-380 225,-422\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"6.5,-380 6.5,-422 59.5,-422 59.5,-380 6.5,-380\"/>\n<text text-anchor=\"start\" x=\"14.5\" y=\"-404\" font-family=\"Linux libertine\" font-size=\"10.00\">Conv2d</text>\n<text text-anchor=\"start\" x=\"11.5\" y=\"-393\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"59.5,-401 59.5,-422 118.5,-422 118.5,-401 59.5,-401\"/>\n<text text-anchor=\"start\" x=\"70.5\" y=\"-409\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"118.5,-401 118.5,-422 225.5,-422 225.5,-401 118.5,-401\"/>\n<text text-anchor=\"start\" x=\"123.5\" y=\"-409\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 16, 16, 16) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"59.5,-380 59.5,-401 118.5,-401 118.5,-380 59.5,-380\"/>\n<text text-anchor=\"start\" x=\"64.5\" y=\"-388\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"118.5,-380 118.5,-401 225.5,-401 225.5,-380 118.5,-380\"/>\n<text text-anchor=\"start\" x=\"123.5\" y=\"-388\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 32, 16, 16) </text>\n</g>\n<!-- 3&#45;&gt;4 -->\n<g id=\"edge4\" class=\"edge\">\n<title>3&#45;&gt;4</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-457.63C115.5,-449.82 115.5,-440.73 115.5,-432.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-432.16 115.5,-422.16 112,-432.16 119,-432.16\"/>\n</g>\n<!-- 5 -->\n<g id=\"node6\" class=\"node\">\n<title>5</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"225,-344 6,-344 6,-302 225,-302 225,-344\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"6.5,-302 6.5,-344 59.5,-344 59.5,-302 6.5,-302\"/>\n<text text-anchor=\"start\" x=\"20.5\" y=\"-326\" font-family=\"Linux libertine\" font-size=\"10.00\">ReLU</text>\n<text text-anchor=\"start\" x=\"11.5\" y=\"-315\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"59.5,-323 59.5,-344 118.5,-344 118.5,-323 59.5,-323\"/>\n<text text-anchor=\"start\" x=\"70.5\" y=\"-331\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"118.5,-323 118.5,-344 225.5,-344 225.5,-323 118.5,-323\"/>\n<text text-anchor=\"start\" x=\"123.5\" y=\"-331\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 32, 16, 16) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"59.5,-302 59.5,-323 118.5,-323 118.5,-302 59.5,-302\"/>\n<text text-anchor=\"start\" x=\"64.5\" y=\"-310\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"118.5,-302 118.5,-323 225.5,-323 225.5,-302 118.5,-302\"/>\n<text text-anchor=\"start\" x=\"123.5\" y=\"-310\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 32, 16, 16) </text>\n</g>\n<!-- 4&#45;&gt;5 -->\n<g id=\"edge5\" class=\"edge\">\n<title>4&#45;&gt;5</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-379.63C115.5,-371.82 115.5,-362.73 115.5,-354.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-354.16 115.5,-344.16 112,-354.16 119,-354.16\"/>\n</g>\n<!-- 6 -->\n<g id=\"node7\" class=\"node\">\n<title>6</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"231,-266 0,-266 0,-224 231,-224 231,-266\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"0.5,-224 0.5,-266 65.5,-266 65.5,-224 0.5,-224\"/>\n<text text-anchor=\"start\" x=\"5.5\" y=\"-248\" font-family=\"Linux libertine\" font-size=\"10.00\">MaxPool2d</text>\n<text text-anchor=\"start\" x=\"11.5\" y=\"-237\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"65.5,-245 65.5,-266 124.5,-266 124.5,-245 65.5,-245\"/>\n<text text-anchor=\"start\" x=\"76.5\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"124.5,-245 124.5,-266 231.5,-266 231.5,-245 124.5,-245\"/>\n<text text-anchor=\"start\" x=\"129.5\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 32, 16, 16) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"65.5,-224 65.5,-245 124.5,-245 124.5,-224 65.5,-224\"/>\n<text text-anchor=\"start\" x=\"70.5\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"124.5,-224 124.5,-245 231.5,-245 231.5,-224 124.5,-224\"/>\n<text text-anchor=\"start\" x=\"135.5\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 32, 8, 8) </text>\n</g>\n<!-- 5&#45;&gt;6 -->\n<g id=\"edge6\" class=\"edge\">\n<title>5&#45;&gt;6</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-301.63C115.5,-293.82 115.5,-284.73 115.5,-276.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-276.16 115.5,-266.16 112,-276.16 119,-276.16\"/>\n</g>\n<!-- 7 -->\n<g id=\"node8\" class=\"node\">\n<title>7</title>\n<polygon fill=\"aliceblue\" stroke=\"transparent\" points=\"219,-188 12,-188 12,-146 219,-146 219,-188\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"12.5,-146 12.5,-188 65.5,-188 65.5,-146 12.5,-146\"/>\n<text text-anchor=\"start\" x=\"26.5\" y=\"-170\" font-family=\"Linux libertine\" font-size=\"10.00\">view</text>\n<text text-anchor=\"start\" x=\"17.5\" y=\"-159\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"65.5,-167 65.5,-188 124.5,-188 124.5,-167 65.5,-167\"/>\n<text text-anchor=\"start\" x=\"76.5\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"124.5,-167 124.5,-188 219.5,-188 219.5,-167 124.5,-167\"/>\n<text text-anchor=\"start\" x=\"129.5\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 32, 8, 8) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"65.5,-146 65.5,-167 124.5,-167 124.5,-146 65.5,-146\"/>\n<text text-anchor=\"start\" x=\"70.5\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"124.5,-146 124.5,-167 219.5,-167 219.5,-146 124.5,-146\"/>\n<text text-anchor=\"start\" x=\"141.5\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 2048) </text>\n</g>\n<!-- 6&#45;&gt;7 -->\n<g id=\"edge7\" class=\"edge\">\n<title>6&#45;&gt;7</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-223.63C115.5,-215.82 115.5,-206.73 115.5,-198.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-198.16 115.5,-188.16 112,-198.16 119,-198.16\"/>\n</g>\n<!-- 8 -->\n<g id=\"node9\" class=\"node\">\n<title>8</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"207,-110 24,-110 24,-68 207,-68 207,-110\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"24.5,-68 24.5,-110 77.5,-110 77.5,-68 24.5,-68\"/>\n<text text-anchor=\"start\" x=\"32.5\" y=\"-92\" font-family=\"Linux libertine\" font-size=\"10.00\">Linear</text>\n<text text-anchor=\"start\" x=\"29.5\" y=\"-81\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"77.5,-89 77.5,-110 136.5,-110 136.5,-89 77.5,-89\"/>\n<text text-anchor=\"start\" x=\"88.5\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"136.5,-89 136.5,-110 207.5,-110 207.5,-89 136.5,-89\"/>\n<text text-anchor=\"start\" x=\"141.5\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 2048) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"77.5,-68 77.5,-89 136.5,-89 136.5,-68 77.5,-68\"/>\n<text text-anchor=\"start\" x=\"82.5\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"136.5,-68 136.5,-89 207.5,-89 207.5,-68 136.5,-68\"/>\n<text text-anchor=\"start\" x=\"147.5\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10) </text>\n</g>\n<!-- 7&#45;&gt;8 -->\n<g id=\"edge8\" class=\"edge\">\n<title>7&#45;&gt;8</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-145.63C115.5,-137.82 115.5,-128.73 115.5,-120.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-120.16 115.5,-110.16 112,-120.16 119,-120.16\"/>\n</g>\n<!-- 9 -->\n<g id=\"node10\" class=\"node\">\n<title>9</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"186.5,-32 44.5,-32 44.5,0 186.5,0 186.5,-32\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"44.5,0 44.5,-32 133.5,-32 133.5,0 44.5,0\"/>\n<text text-anchor=\"start\" x=\"49.5\" y=\"-19\" font-family=\"Linux libertine\" font-size=\"10.00\">output&#45;tensor</text>\n<text text-anchor=\"start\" x=\"67.5\" y=\"-8\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"133.5,0 133.5,-32 186.5,-32 186.5,0 133.5,0\"/>\n<text text-anchor=\"start\" x=\"138.5\" y=\"-13.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10)</text>\n</g>\n<!-- 8&#45;&gt;9 -->\n<g id=\"edge9\" class=\"edge\">\n<title>8&#45;&gt;9</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-67.84C115.5,-59.89 115.5,-50.66 115.5,-42.26\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-42.24 115.5,-32.24 112,-42.24 119,-42.24\"/>\n</g>\n</g>\n</svg>\n",
"text/plain": [
"<graphviz.graphs.Digraph at 0x79873d9150a0>"
]
},
"metadata": {},
"execution_count": 34
}
]
},
{
"cell_type": "code",
"source": [
"class DomainAdaptationModel(nn.Module):\n",
" def __init__(self):\n",
" super(DomainAdaptationModel, self).__init__()\n",
" # A shared feature extractor\n",
" self.feature_extractor = nn.Sequential(\n",
" nn.Conv2d(3, 64, kernel_size=5),\n",
" nn.ReLU(),\n",
" nn.MaxPool2d(2),\n",
" nn.Conv2d(64, 128, kernel_size=5),\n",
" nn.ReLU(),\n",
" nn.MaxPool2d(2)\n",
" )\n",
" # Separate classifiers for each domain\n",
" self.hq_classifier = nn.Linear(128 * 5 * 5, 10)\n",
" self.lq_classifier = nn.Linear(128 * 5 * 5, 10)\n",
"\n",
" def forward(self, x_dict):\n",
" hq_features = self.feature_extractor(x_dict['x_hq'])\n",
" hq_features = hq_features.view(hq_features.size(0), -1)\n",
" hq_output = self.hq_classifier(hq_features)\n",
"\n",
" lq_features = self.feature_extractor(x_dict['x_lq'])\n",
" lq_features = lq_features.view(lq_features.size(0), -1)\n",
" lq_output = self.lq_classifier(lq_features)\n",
"\n",
" return {'hq_output': hq_output, 'lq_output': lq_output}"
],
"metadata": {
"id": "ovY4aIpqDCJx"
},
"execution_count": 19,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Instantiate the model\n",
"model = DomainAdaptationModel()\n",
"\n",
"# Create dummy input data\n",
"hq_images, lq_images = torch.randn(1, 3, 32, 32), torch.randn(1, 3, 32, 32)\n",
"\n",
"# Visualize the model with dictionary input\n",
"model_graph = draw_graph(\n",
" model,\n",
" input_data=[{'x_hq': hq_images, 'x_lq': lq_images}], # In a list so that the function do not unpack the args (give the dict if the model forward() function don't take the dict as input)\n",
" graph_name='DomainAdaptationModel',\n",
" expand_nested=True, # Shows the modules inside the model in dashed line container\n",
" depth=2 # Depth for nested models\n",
")\n",
"\n",
"\n",
"model_graph.visual_graph"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 998
},
"id": "m_kX0INkC9yY",
"outputId": "c50a6afe-9011-4ac3-efa7-021051497d5d"
},
"execution_count": 29,
"outputs": [
{
"output_type": "execute_result",
"data": {
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.43.0 (0)\n -->\n<!-- Title: DomainAdaptationModel Pages: 1 -->\n<svg width=\"540pt\" height=\"733pt\"\n viewBox=\"0.00 0.00 540.00 733.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 729)\">\n<title>DomainAdaptationModel</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-729 536,-729 536,4 -4,4\"/>\n<g id=\"clust1\" class=\"cluster\">\n<title>cluster_2</title>\n<polygon fill=\"none\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"8,-216 8,-685 262,-685 262,-216 8,-216\"/>\n<text text-anchor=\"middle\" x=\"41\" y=\"-671.4\" font-family=\"Times,serif\" font-size=\"12.00\">Sequential</text>\n</g>\n<g id=\"clust2\" class=\"cluster\">\n<title>cluster_3</title>\n<polygon fill=\"none\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"270,-216 270,-685 524,-685 524,-216 270,-216\"/>\n<text text-anchor=\"middle\" x=\"303\" y=\"-671.4\" font-family=\"Times,serif\" font-size=\"12.00\">Sequential</text>\n</g>\n<!-- 0 -->\n<g id=\"node1\" class=\"node\">\n<title>0</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"224,-725 46,-725 46,-693 224,-693 224,-725\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"46,-693 46,-725 129,-725 129,-693 46,-693\"/>\n<text text-anchor=\"start\" x=\"51\" y=\"-712\" font-family=\"Linux libertine\" font-size=\"10.00\">input&#45;tensor</text>\n<text text-anchor=\"start\" x=\"66\" y=\"-701\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"129,-693 129,-725 224,-725 224,-693 129,-693\"/>\n<text text-anchor=\"start\" x=\"134\" y=\"-706.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32)</text>\n</g>\n<!-- 2 -->\n<g id=\"node3\" class=\"node\">\n<title>2</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"244.5,-656 25.5,-656 25.5,-614 244.5,-614 244.5,-656\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"26,-614 26,-656 79,-656 79,-614 26,-614\"/>\n<text text-anchor=\"start\" x=\"34\" y=\"-638\" font-family=\"Linux libertine\" font-size=\"10.00\">Conv2d</text>\n<text text-anchor=\"start\" x=\"31\" y=\"-627\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"79,-635 79,-656 138,-656 138,-635 79,-635\"/>\n<text text-anchor=\"start\" x=\"90\" y=\"-643\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"138,-635 138,-656 245,-656 245,-635 138,-635\"/>\n<text text-anchor=\"start\" x=\"146\" y=\"-643\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"79,-614 79,-635 138,-635 138,-614 79,-614\"/>\n<text text-anchor=\"start\" x=\"84\" y=\"-622\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"138,-614 138,-635 245,-635 245,-614 138,-614\"/>\n<text text-anchor=\"start\" x=\"143\" y=\"-622\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 28, 28) </text>\n</g>\n<!-- 0&#45;&gt;2 -->\n<g id=\"edge1\" class=\"edge\">\n<title>0&#45;&gt;2</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-692.73C135,-685.08 135,-675.52 135,-666.45\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-666.17 135,-656.17 131.5,-666.17 138.5,-666.17\"/>\n</g>\n<!-- 1 -->\n<g id=\"node2\" class=\"node\">\n<title>1</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"486,-725 308,-725 308,-693 486,-693 486,-725\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"308,-693 308,-725 391,-725 391,-693 308,-693\"/>\n<text text-anchor=\"start\" x=\"313\" y=\"-712\" font-family=\"Linux libertine\" font-size=\"10.00\">input&#45;tensor</text>\n<text text-anchor=\"start\" x=\"328\" y=\"-701\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"391,-693 391,-725 486,-725 486,-693 391,-693\"/>\n<text text-anchor=\"start\" x=\"396\" y=\"-706.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32)</text>\n</g>\n<!-- 11 -->\n<g id=\"node12\" class=\"node\">\n<title>11</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"506.5,-656 287.5,-656 287.5,-614 506.5,-614 506.5,-656\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"288,-614 288,-656 341,-656 341,-614 288,-614\"/>\n<text text-anchor=\"start\" x=\"296\" y=\"-638\" font-family=\"Linux libertine\" font-size=\"10.00\">Conv2d</text>\n<text text-anchor=\"start\" x=\"293\" y=\"-627\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"341,-635 341,-656 400,-656 400,-635 341,-635\"/>\n<text text-anchor=\"start\" x=\"352\" y=\"-643\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"400,-635 400,-656 507,-656 507,-635 400,-635\"/>\n<text text-anchor=\"start\" x=\"408\" y=\"-643\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"341,-614 341,-635 400,-635 400,-614 341,-614\"/>\n<text text-anchor=\"start\" x=\"346\" y=\"-622\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"400,-614 400,-635 507,-635 507,-614 400,-614\"/>\n<text text-anchor=\"start\" x=\"405\" y=\"-622\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 28, 28) </text>\n</g>\n<!-- 1&#45;&gt;11 -->\n<g id=\"edge10\" class=\"edge\">\n<title>1&#45;&gt;11</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-692.73C397,-685.08 397,-675.52 397,-666.45\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-666.17 397,-656.17 393.5,-666.17 400.5,-666.17\"/>\n</g>\n<!-- 3 -->\n<g id=\"node4\" class=\"node\">\n<title>3</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"244.5,-578 25.5,-578 25.5,-536 244.5,-536 244.5,-578\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"26,-536 26,-578 79,-578 79,-536 26,-536\"/>\n<text text-anchor=\"start\" x=\"40\" y=\"-560\" font-family=\"Linux libertine\" font-size=\"10.00\">ReLU</text>\n<text text-anchor=\"start\" x=\"31\" y=\"-549\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"79,-557 79,-578 138,-578 138,-557 79,-557\"/>\n<text text-anchor=\"start\" x=\"90\" y=\"-565\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"138,-557 138,-578 245,-578 245,-557 138,-557\"/>\n<text text-anchor=\"start\" x=\"143\" y=\"-565\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 28, 28) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"79,-536 79,-557 138,-557 138,-536 79,-536\"/>\n<text text-anchor=\"start\" x=\"84\" y=\"-544\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"138,-536 138,-557 245,-557 245,-536 138,-536\"/>\n<text text-anchor=\"start\" x=\"143\" y=\"-544\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 28, 28) </text>\n</g>\n<!-- 2&#45;&gt;3 -->\n<g id=\"edge2\" class=\"edge\">\n<title>2&#45;&gt;3</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-613.63C135,-605.82 135,-596.73 135,-588.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-588.16 135,-578.16 131.5,-588.16 138.5,-588.16\"/>\n</g>\n<!-- 4 -->\n<g id=\"node5\" class=\"node\">\n<title>4</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"250.5,-500 19.5,-500 19.5,-458 250.5,-458 250.5,-500\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"20,-458 20,-500 85,-500 85,-458 20,-458\"/>\n<text text-anchor=\"start\" x=\"25\" y=\"-482\" font-family=\"Linux libertine\" font-size=\"10.00\">MaxPool2d</text>\n<text text-anchor=\"start\" x=\"31\" y=\"-471\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"85,-479 85,-500 144,-500 144,-479 85,-479\"/>\n<text text-anchor=\"start\" x=\"96\" y=\"-487\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"144,-479 144,-500 251,-500 251,-479 144,-479\"/>\n<text text-anchor=\"start\" x=\"149\" y=\"-487\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 28, 28) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"85,-458 85,-479 144,-479 144,-458 85,-458\"/>\n<text text-anchor=\"start\" x=\"90\" y=\"-466\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"144,-458 144,-479 251,-479 251,-458 144,-458\"/>\n<text text-anchor=\"start\" x=\"149\" y=\"-466\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 14, 14) </text>\n</g>\n<!-- 3&#45;&gt;4 -->\n<g id=\"edge3\" class=\"edge\">\n<title>3&#45;&gt;4</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-535.63C135,-527.82 135,-518.73 135,-510.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-510.16 135,-500.16 131.5,-510.16 138.5,-510.16\"/>\n</g>\n<!-- 5 -->\n<g id=\"node6\" class=\"node\">\n<title>5</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"247.5,-422 22.5,-422 22.5,-380 247.5,-380 247.5,-422\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"23,-380 23,-422 76,-422 76,-380 23,-380\"/>\n<text text-anchor=\"start\" x=\"31\" y=\"-404\" font-family=\"Linux libertine\" font-size=\"10.00\">Conv2d</text>\n<text text-anchor=\"start\" x=\"28\" y=\"-393\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"76,-401 76,-422 135,-422 135,-401 76,-401\"/>\n<text text-anchor=\"start\" x=\"87\" y=\"-409\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"135,-401 135,-422 248,-422 248,-401 135,-401\"/>\n<text text-anchor=\"start\" x=\"143\" y=\"-409\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 14, 14) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"76,-380 76,-401 135,-401 135,-380 76,-380\"/>\n<text text-anchor=\"start\" x=\"81\" y=\"-388\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"135,-380 135,-401 248,-401 248,-380 135,-380\"/>\n<text text-anchor=\"start\" x=\"140\" y=\"-388\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 10, 10) </text>\n</g>\n<!-- 4&#45;&gt;5 -->\n<g id=\"edge4\" class=\"edge\">\n<title>4&#45;&gt;5</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-457.63C135,-449.82 135,-440.73 135,-432.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-432.16 135,-422.16 131.5,-432.16 138.5,-432.16\"/>\n</g>\n<!-- 6 -->\n<g id=\"node7\" class=\"node\">\n<title>6</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"247.5,-344 22.5,-344 22.5,-302 247.5,-302 247.5,-344\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"23,-302 23,-344 76,-344 76,-302 23,-302\"/>\n<text text-anchor=\"start\" x=\"37\" y=\"-326\" font-family=\"Linux libertine\" font-size=\"10.00\">ReLU</text>\n<text text-anchor=\"start\" x=\"28\" y=\"-315\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"76,-323 76,-344 135,-344 135,-323 76,-323\"/>\n<text text-anchor=\"start\" x=\"87\" y=\"-331\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"135,-323 135,-344 248,-344 248,-323 135,-323\"/>\n<text text-anchor=\"start\" x=\"140\" y=\"-331\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 10, 10) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"76,-302 76,-323 135,-323 135,-302 76,-302\"/>\n<text text-anchor=\"start\" x=\"81\" y=\"-310\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"135,-302 135,-323 248,-323 248,-302 135,-302\"/>\n<text text-anchor=\"start\" x=\"140\" y=\"-310\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 10, 10) </text>\n</g>\n<!-- 5&#45;&gt;6 -->\n<g id=\"edge5\" class=\"edge\">\n<title>5&#45;&gt;6</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-379.63C135,-371.82 135,-362.73 135,-354.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-354.16 135,-344.16 131.5,-354.16 138.5,-354.16\"/>\n</g>\n<!-- 7 -->\n<g id=\"node8\" class=\"node\">\n<title>7</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"253.5,-266 16.5,-266 16.5,-224 253.5,-224 253.5,-266\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"17,-224 17,-266 82,-266 82,-224 17,-224\"/>\n<text text-anchor=\"start\" x=\"22\" y=\"-248\" font-family=\"Linux libertine\" font-size=\"10.00\">MaxPool2d</text>\n<text text-anchor=\"start\" x=\"28\" y=\"-237\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"82,-245 82,-266 141,-266 141,-245 82,-245\"/>\n<text text-anchor=\"start\" x=\"93\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"141,-245 141,-266 254,-266 254,-245 141,-245\"/>\n<text text-anchor=\"start\" x=\"146\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 10, 10) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"82,-224 82,-245 141,-245 141,-224 82,-224\"/>\n<text text-anchor=\"start\" x=\"87\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"141,-224 141,-245 254,-245 254,-224 141,-224\"/>\n<text text-anchor=\"start\" x=\"152\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 5, 5) </text>\n</g>\n<!-- 6&#45;&gt;7 -->\n<g id=\"edge6\" class=\"edge\">\n<title>6&#45;&gt;7</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-301.63C135,-293.82 135,-284.73 135,-276.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-276.16 135,-266.16 131.5,-276.16 138.5,-276.16\"/>\n</g>\n<!-- 8 -->\n<g id=\"node9\" class=\"node\">\n<title>8</title>\n<polygon fill=\"aliceblue\" stroke=\"transparent\" points=\"241.5,-188 28.5,-188 28.5,-146 241.5,-146 241.5,-188\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"29,-146 29,-188 82,-188 82,-146 29,-146\"/>\n<text text-anchor=\"start\" x=\"43\" y=\"-170\" font-family=\"Linux libertine\" font-size=\"10.00\">view</text>\n<text text-anchor=\"start\" x=\"34\" y=\"-159\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"82,-167 82,-188 141,-188 141,-167 82,-167\"/>\n<text text-anchor=\"start\" x=\"93\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"141,-167 141,-188 242,-188 242,-167 141,-167\"/>\n<text text-anchor=\"start\" x=\"146\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 5, 5) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"82,-146 82,-167 141,-167 141,-146 82,-146\"/>\n<text text-anchor=\"start\" x=\"87\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"141,-146 141,-167 242,-167 242,-146 141,-146\"/>\n<text text-anchor=\"start\" x=\"161\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3200) </text>\n</g>\n<!-- 7&#45;&gt;8 -->\n<g id=\"edge7\" class=\"edge\">\n<title>7&#45;&gt;8</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-223.63C135,-215.82 135,-206.73 135,-198.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-198.16 135,-188.16 131.5,-198.16 138.5,-198.16\"/>\n</g>\n<!-- 9 -->\n<g id=\"node10\" class=\"node\">\n<title>9</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"226.5,-110 43.5,-110 43.5,-68 226.5,-68 226.5,-110\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"44,-68 44,-110 97,-110 97,-68 44,-68\"/>\n<text text-anchor=\"start\" x=\"52\" y=\"-92\" font-family=\"Linux libertine\" font-size=\"10.00\">Linear</text>\n<text text-anchor=\"start\" x=\"49\" y=\"-81\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"97,-89 97,-110 156,-110 156,-89 97,-89\"/>\n<text text-anchor=\"start\" x=\"108\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"156,-89 156,-110 227,-110 227,-89 156,-89\"/>\n<text text-anchor=\"start\" x=\"161\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3200) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"97,-68 97,-89 156,-89 156,-68 97,-68\"/>\n<text text-anchor=\"start\" x=\"102\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"156,-68 156,-89 227,-89 227,-68 156,-68\"/>\n<text text-anchor=\"start\" x=\"167\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10) </text>\n</g>\n<!-- 8&#45;&gt;9 -->\n<g id=\"edge8\" class=\"edge\">\n<title>8&#45;&gt;9</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-145.63C135,-137.82 135,-128.73 135,-120.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-120.16 135,-110.16 131.5,-120.16 138.5,-120.16\"/>\n</g>\n<!-- 10 -->\n<g id=\"node11\" class=\"node\">\n<title>10</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"206,-32 64,-32 64,0 206,0 206,-32\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"64,0 64,-32 153,-32 153,0 64,0\"/>\n<text text-anchor=\"start\" x=\"69\" y=\"-19\" font-family=\"Linux libertine\" font-size=\"10.00\">output&#45;tensor</text>\n<text text-anchor=\"start\" x=\"87\" y=\"-8\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"153,0 153,-32 206,-32 206,0 153,0\"/>\n<text text-anchor=\"start\" x=\"158\" y=\"-13.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10)</text>\n</g>\n<!-- 9&#45;&gt;10 -->\n<g id=\"edge9\" class=\"edge\">\n<title>9&#45;&gt;10</title>\n<path fill=\"none\" stroke=\"black\" d=\"M135,-67.84C135,-59.89 135,-50.66 135,-42.26\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"138.5,-42.24 135,-32.24 131.5,-42.24 138.5,-42.24\"/>\n</g>\n<!-- 12 -->\n<g id=\"node13\" class=\"node\">\n<title>12</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"506.5,-578 287.5,-578 287.5,-536 506.5,-536 506.5,-578\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"288,-536 288,-578 341,-578 341,-536 288,-536\"/>\n<text text-anchor=\"start\" x=\"302\" y=\"-560\" font-family=\"Linux libertine\" font-size=\"10.00\">ReLU</text>\n<text text-anchor=\"start\" x=\"293\" y=\"-549\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"341,-557 341,-578 400,-578 400,-557 341,-557\"/>\n<text text-anchor=\"start\" x=\"352\" y=\"-565\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"400,-557 400,-578 507,-578 507,-557 400,-557\"/>\n<text text-anchor=\"start\" x=\"405\" y=\"-565\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 28, 28) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"341,-536 341,-557 400,-557 400,-536 341,-536\"/>\n<text text-anchor=\"start\" x=\"346\" y=\"-544\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"400,-536 400,-557 507,-557 507,-536 400,-536\"/>\n<text text-anchor=\"start\" x=\"405\" y=\"-544\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 28, 28) </text>\n</g>\n<!-- 11&#45;&gt;12 -->\n<g id=\"edge11\" class=\"edge\">\n<title>11&#45;&gt;12</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-613.63C397,-605.82 397,-596.73 397,-588.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-588.16 397,-578.16 393.5,-588.16 400.5,-588.16\"/>\n</g>\n<!-- 13 -->\n<g id=\"node14\" class=\"node\">\n<title>13</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"512.5,-500 281.5,-500 281.5,-458 512.5,-458 512.5,-500\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"282,-458 282,-500 347,-500 347,-458 282,-458\"/>\n<text text-anchor=\"start\" x=\"287\" y=\"-482\" font-family=\"Linux libertine\" font-size=\"10.00\">MaxPool2d</text>\n<text text-anchor=\"start\" x=\"293\" y=\"-471\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"347,-479 347,-500 406,-500 406,-479 347,-479\"/>\n<text text-anchor=\"start\" x=\"358\" y=\"-487\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"406,-479 406,-500 513,-500 513,-479 406,-479\"/>\n<text text-anchor=\"start\" x=\"411\" y=\"-487\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 28, 28) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"347,-458 347,-479 406,-479 406,-458 347,-458\"/>\n<text text-anchor=\"start\" x=\"352\" y=\"-466\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"406,-458 406,-479 513,-479 513,-458 406,-458\"/>\n<text text-anchor=\"start\" x=\"411\" y=\"-466\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 14, 14) </text>\n</g>\n<!-- 12&#45;&gt;13 -->\n<g id=\"edge12\" class=\"edge\">\n<title>12&#45;&gt;13</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-535.63C397,-527.82 397,-518.73 397,-510.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-510.16 397,-500.16 393.5,-510.16 400.5,-510.16\"/>\n</g>\n<!-- 14 -->\n<g id=\"node15\" class=\"node\">\n<title>14</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"509.5,-422 284.5,-422 284.5,-380 509.5,-380 509.5,-422\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"285,-380 285,-422 338,-422 338,-380 285,-380\"/>\n<text text-anchor=\"start\" x=\"293\" y=\"-404\" font-family=\"Linux libertine\" font-size=\"10.00\">Conv2d</text>\n<text text-anchor=\"start\" x=\"290\" y=\"-393\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"338,-401 338,-422 397,-422 397,-401 338,-401\"/>\n<text text-anchor=\"start\" x=\"349\" y=\"-409\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"397,-401 397,-422 510,-422 510,-401 397,-401\"/>\n<text text-anchor=\"start\" x=\"405\" y=\"-409\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 64, 14, 14) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"338,-380 338,-401 397,-401 397,-380 338,-380\"/>\n<text text-anchor=\"start\" x=\"343\" y=\"-388\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"397,-380 397,-401 510,-401 510,-380 397,-380\"/>\n<text text-anchor=\"start\" x=\"402\" y=\"-388\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 10, 10) </text>\n</g>\n<!-- 13&#45;&gt;14 -->\n<g id=\"edge13\" class=\"edge\">\n<title>13&#45;&gt;14</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-457.63C397,-449.82 397,-440.73 397,-432.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-432.16 397,-422.16 393.5,-432.16 400.5,-432.16\"/>\n</g>\n<!-- 15 -->\n<g id=\"node16\" class=\"node\">\n<title>15</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"509.5,-344 284.5,-344 284.5,-302 509.5,-302 509.5,-344\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"285,-302 285,-344 338,-344 338,-302 285,-302\"/>\n<text text-anchor=\"start\" x=\"299\" y=\"-326\" font-family=\"Linux libertine\" font-size=\"10.00\">ReLU</text>\n<text text-anchor=\"start\" x=\"290\" y=\"-315\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"338,-323 338,-344 397,-344 397,-323 338,-323\"/>\n<text text-anchor=\"start\" x=\"349\" y=\"-331\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"397,-323 397,-344 510,-344 510,-323 397,-323\"/>\n<text text-anchor=\"start\" x=\"402\" y=\"-331\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 10, 10) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"338,-302 338,-323 397,-323 397,-302 338,-302\"/>\n<text text-anchor=\"start\" x=\"343\" y=\"-310\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"397,-302 397,-323 510,-323 510,-302 397,-302\"/>\n<text text-anchor=\"start\" x=\"402\" y=\"-310\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 10, 10) </text>\n</g>\n<!-- 14&#45;&gt;15 -->\n<g id=\"edge14\" class=\"edge\">\n<title>14&#45;&gt;15</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-379.63C397,-371.82 397,-362.73 397,-354.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-354.16 397,-344.16 393.5,-354.16 400.5,-354.16\"/>\n</g>\n<!-- 16 -->\n<g id=\"node17\" class=\"node\">\n<title>16</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"515.5,-266 278.5,-266 278.5,-224 515.5,-224 515.5,-266\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"279,-224 279,-266 344,-266 344,-224 279,-224\"/>\n<text text-anchor=\"start\" x=\"284\" y=\"-248\" font-family=\"Linux libertine\" font-size=\"10.00\">MaxPool2d</text>\n<text text-anchor=\"start\" x=\"290\" y=\"-237\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:2</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"344,-245 344,-266 403,-266 403,-245 344,-245\"/>\n<text text-anchor=\"start\" x=\"355\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"403,-245 403,-266 516,-266 516,-245 403,-245\"/>\n<text text-anchor=\"start\" x=\"408\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 10, 10) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"344,-224 344,-245 403,-245 403,-224 344,-224\"/>\n<text text-anchor=\"start\" x=\"349\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"403,-224 403,-245 516,-245 516,-224 403,-224\"/>\n<text text-anchor=\"start\" x=\"414\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 5, 5) </text>\n</g>\n<!-- 15&#45;&gt;16 -->\n<g id=\"edge15\" class=\"edge\">\n<title>15&#45;&gt;16</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-301.63C397,-293.82 397,-284.73 397,-276.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-276.16 397,-266.16 393.5,-276.16 400.5,-276.16\"/>\n</g>\n<!-- 17 -->\n<g id=\"node18\" class=\"node\">\n<title>17</title>\n<polygon fill=\"aliceblue\" stroke=\"transparent\" points=\"503.5,-188 290.5,-188 290.5,-146 503.5,-146 503.5,-188\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"291,-146 291,-188 344,-188 344,-146 291,-146\"/>\n<text text-anchor=\"start\" x=\"305\" y=\"-170\" font-family=\"Linux libertine\" font-size=\"10.00\">view</text>\n<text text-anchor=\"start\" x=\"296\" y=\"-159\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"344,-167 344,-188 403,-188 403,-167 344,-167\"/>\n<text text-anchor=\"start\" x=\"355\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"403,-167 403,-188 504,-188 504,-167 403,-167\"/>\n<text text-anchor=\"start\" x=\"408\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 5, 5) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"344,-146 344,-167 403,-167 403,-146 344,-146\"/>\n<text text-anchor=\"start\" x=\"349\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"403,-146 403,-167 504,-167 504,-146 403,-146\"/>\n<text text-anchor=\"start\" x=\"423\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3200) </text>\n</g>\n<!-- 16&#45;&gt;17 -->\n<g id=\"edge16\" class=\"edge\">\n<title>16&#45;&gt;17</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-223.63C397,-215.82 397,-206.73 397,-198.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-198.16 397,-188.16 393.5,-198.16 400.5,-198.16\"/>\n</g>\n<!-- 18 -->\n<g id=\"node19\" class=\"node\">\n<title>18</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"488.5,-110 305.5,-110 305.5,-68 488.5,-68 488.5,-110\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"306,-68 306,-110 359,-110 359,-68 306,-68\"/>\n<text text-anchor=\"start\" x=\"314\" y=\"-92\" font-family=\"Linux libertine\" font-size=\"10.00\">Linear</text>\n<text text-anchor=\"start\" x=\"311\" y=\"-81\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"359,-89 359,-110 418,-110 418,-89 359,-89\"/>\n<text text-anchor=\"start\" x=\"370\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"418,-89 418,-110 489,-110 489,-89 418,-89\"/>\n<text text-anchor=\"start\" x=\"423\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3200) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"359,-68 359,-89 418,-89 418,-68 359,-68\"/>\n<text text-anchor=\"start\" x=\"364\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"418,-68 418,-89 489,-89 489,-68 418,-68\"/>\n<text text-anchor=\"start\" x=\"429\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10) </text>\n</g>\n<!-- 17&#45;&gt;18 -->\n<g id=\"edge17\" class=\"edge\">\n<title>17&#45;&gt;18</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-145.63C397,-137.82 397,-128.73 397,-120.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-120.16 397,-110.16 393.5,-120.16 400.5,-120.16\"/>\n</g>\n<!-- 19 -->\n<g id=\"node20\" class=\"node\">\n<title>19</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"468,-32 326,-32 326,0 468,0 468,-32\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"326,0 326,-32 415,-32 415,0 326,0\"/>\n<text text-anchor=\"start\" x=\"331\" y=\"-19\" font-family=\"Linux libertine\" font-size=\"10.00\">output&#45;tensor</text>\n<text text-anchor=\"start\" x=\"349\" y=\"-8\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"415,0 415,-32 468,-32 468,0 415,0\"/>\n<text text-anchor=\"start\" x=\"420\" y=\"-13.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10)</text>\n</g>\n<!-- 18&#45;&gt;19 -->\n<g id=\"edge18\" class=\"edge\">\n<title>18&#45;&gt;19</title>\n<path fill=\"none\" stroke=\"black\" d=\"M397,-67.84C397,-59.89 397,-50.66 397,-42.26\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"400.5,-42.24 397,-32.24 393.5,-42.24 400.5,-42.24\"/>\n</g>\n</g>\n</svg>\n",
"text/plain": [
"<graphviz.graphs.Digraph at 0x79873d805df0>"
]
},
"metadata": {},
"execution_count": 29
}
]
},
{
"cell_type": "code",
"source": [
"model_graph = draw_graph(\n",
" model,\n",
" input_data=[{'x_hq': hq_images, 'x_lq': lq_images}],\n",
" graph_name='DomainAdaptationModel',\n",
" expand_nested=False,\n",
" depth=1\n",
")\n",
"\n",
"model_graph.visual_graph"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 477
},
"id": "0K2ztal6EqZB",
"outputId": "35ae9af9-7221-457c-cf8c-4a086b3e17ce"
},
"execution_count": 27,
"outputs": [
{
"output_type": "execute_result",
"data": {
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.43.0 (0)\n -->\n<!-- Title: DomainAdaptationModel Pages: 1 -->\n<svg width=\"488pt\" height=\"342pt\"\n viewBox=\"0.00 0.00 488.00 342.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 338)\">\n<title>DomainAdaptationModel</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-338 484,-338 484,4 -4,4\"/>\n<!-- 0 -->\n<g id=\"node1\" class=\"node\">\n<title>0</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"204.5,-334 26.5,-334 26.5,-302 204.5,-302 204.5,-334\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"26.5,-302 26.5,-334 109.5,-334 109.5,-302 26.5,-302\"/>\n<text text-anchor=\"start\" x=\"31.5\" y=\"-321\" font-family=\"Linux libertine\" font-size=\"10.00\">input&#45;tensor</text>\n<text text-anchor=\"start\" x=\"46.5\" y=\"-310\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"109.5,-302 109.5,-334 204.5,-334 204.5,-302 109.5,-302\"/>\n<text text-anchor=\"start\" x=\"114.5\" y=\"-315.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32)</text>\n</g>\n<!-- 2 -->\n<g id=\"node3\" class=\"node\">\n<title>2</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"231,-266 0,-266 0,-224 231,-224 231,-266\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"0.5,-224 0.5,-266 71.5,-266 71.5,-224 0.5,-224\"/>\n<text text-anchor=\"start\" x=\"5.5\" y=\"-248\" font-family=\"Linux libertine\" font-size=\"10.00\">Sequential</text>\n<text text-anchor=\"start\" x=\"14.5\" y=\"-237\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"71.5,-245 71.5,-266 130.5,-266 130.5,-245 71.5,-245\"/>\n<text text-anchor=\"start\" x=\"82.5\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"130.5,-245 130.5,-266 231.5,-266 231.5,-245 130.5,-245\"/>\n<text text-anchor=\"start\" x=\"135.5\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"71.5,-224 71.5,-245 130.5,-245 130.5,-224 71.5,-224\"/>\n<text text-anchor=\"start\" x=\"76.5\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"130.5,-224 130.5,-245 231.5,-245 231.5,-224 130.5,-224\"/>\n<text text-anchor=\"start\" x=\"135.5\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 5, 5) </text>\n</g>\n<!-- 0&#45;&gt;2 -->\n<g id=\"edge1\" class=\"edge\">\n<title>0&#45;&gt;2</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-301.94C115.5,-294.45 115.5,-285.12 115.5,-276.24\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-276.16 115.5,-266.16 112,-276.16 119,-276.16\"/>\n</g>\n<!-- 1 -->\n<g id=\"node2\" class=\"node\">\n<title>1</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"453.5,-334 275.5,-334 275.5,-302 453.5,-302 453.5,-334\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"275.5,-302 275.5,-334 358.5,-334 358.5,-302 275.5,-302\"/>\n<text text-anchor=\"start\" x=\"280.5\" y=\"-321\" font-family=\"Linux libertine\" font-size=\"10.00\">input&#45;tensor</text>\n<text text-anchor=\"start\" x=\"295.5\" y=\"-310\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"358.5,-302 358.5,-334 453.5,-334 453.5,-302 358.5,-302\"/>\n<text text-anchor=\"start\" x=\"363.5\" y=\"-315.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32)</text>\n</g>\n<!-- 6 -->\n<g id=\"node7\" class=\"node\">\n<title>6</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"480,-266 249,-266 249,-224 480,-224 480,-266\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"249.5,-224 249.5,-266 320.5,-266 320.5,-224 249.5,-224\"/>\n<text text-anchor=\"start\" x=\"254.5\" y=\"-248\" font-family=\"Linux libertine\" font-size=\"10.00\">Sequential</text>\n<text text-anchor=\"start\" x=\"263.5\" y=\"-237\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"320.5,-245 320.5,-266 379.5,-266 379.5,-245 320.5,-245\"/>\n<text text-anchor=\"start\" x=\"331.5\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"379.5,-245 379.5,-266 480.5,-266 480.5,-245 379.5,-245\"/>\n<text text-anchor=\"start\" x=\"384.5\" y=\"-253\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3, 32, 32) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"320.5,-224 320.5,-245 379.5,-245 379.5,-224 320.5,-224\"/>\n<text text-anchor=\"start\" x=\"325.5\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"379.5,-224 379.5,-245 480.5,-245 480.5,-224 379.5,-224\"/>\n<text text-anchor=\"start\" x=\"384.5\" y=\"-232\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 5, 5) </text>\n</g>\n<!-- 1&#45;&gt;6 -->\n<g id=\"edge2\" class=\"edge\">\n<title>1&#45;&gt;6</title>\n<path fill=\"none\" stroke=\"black\" d=\"M364.5,-301.94C364.5,-294.45 364.5,-285.12 364.5,-276.24\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"368,-276.16 364.5,-266.16 361,-276.16 368,-276.16\"/>\n</g>\n<!-- 3 -->\n<g id=\"node4\" class=\"node\">\n<title>3</title>\n<polygon fill=\"aliceblue\" stroke=\"transparent\" points=\"222,-188 9,-188 9,-146 222,-146 222,-188\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"9.5,-146 9.5,-188 62.5,-188 62.5,-146 9.5,-146\"/>\n<text text-anchor=\"start\" x=\"23.5\" y=\"-170\" font-family=\"Linux libertine\" font-size=\"10.00\">view</text>\n<text text-anchor=\"start\" x=\"14.5\" y=\"-159\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"62.5,-167 62.5,-188 121.5,-188 121.5,-167 62.5,-167\"/>\n<text text-anchor=\"start\" x=\"73.5\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"121.5,-167 121.5,-188 222.5,-188 222.5,-167 121.5,-167\"/>\n<text text-anchor=\"start\" x=\"126.5\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 5, 5) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"62.5,-146 62.5,-167 121.5,-167 121.5,-146 62.5,-146\"/>\n<text text-anchor=\"start\" x=\"67.5\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"121.5,-146 121.5,-167 222.5,-167 222.5,-146 121.5,-146\"/>\n<text text-anchor=\"start\" x=\"141.5\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3200) </text>\n</g>\n<!-- 2&#45;&gt;3 -->\n<g id=\"edge3\" class=\"edge\">\n<title>2&#45;&gt;3</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-223.63C115.5,-215.82 115.5,-206.73 115.5,-198.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-198.16 115.5,-188.16 112,-198.16 119,-198.16\"/>\n</g>\n<!-- 4 -->\n<g id=\"node5\" class=\"node\">\n<title>4</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"207,-110 24,-110 24,-68 207,-68 207,-110\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"24.5,-68 24.5,-110 77.5,-110 77.5,-68 24.5,-68\"/>\n<text text-anchor=\"start\" x=\"32.5\" y=\"-92\" font-family=\"Linux libertine\" font-size=\"10.00\">Linear</text>\n<text text-anchor=\"start\" x=\"29.5\" y=\"-81\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"77.5,-89 77.5,-110 136.5,-110 136.5,-89 77.5,-89\"/>\n<text text-anchor=\"start\" x=\"88.5\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"136.5,-89 136.5,-110 207.5,-110 207.5,-89 136.5,-89\"/>\n<text text-anchor=\"start\" x=\"141.5\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3200) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"77.5,-68 77.5,-89 136.5,-89 136.5,-68 77.5,-68\"/>\n<text text-anchor=\"start\" x=\"82.5\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"136.5,-68 136.5,-89 207.5,-89 207.5,-68 136.5,-68\"/>\n<text text-anchor=\"start\" x=\"147.5\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10) </text>\n</g>\n<!-- 3&#45;&gt;4 -->\n<g id=\"edge4\" class=\"edge\">\n<title>3&#45;&gt;4</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-145.63C115.5,-137.82 115.5,-128.73 115.5,-120.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-120.16 115.5,-110.16 112,-120.16 119,-120.16\"/>\n</g>\n<!-- 5 -->\n<g id=\"node6\" class=\"node\">\n<title>5</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"186.5,-32 44.5,-32 44.5,0 186.5,0 186.5,-32\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"44.5,0 44.5,-32 133.5,-32 133.5,0 44.5,0\"/>\n<text text-anchor=\"start\" x=\"49.5\" y=\"-19\" font-family=\"Linux libertine\" font-size=\"10.00\">output&#45;tensor</text>\n<text text-anchor=\"start\" x=\"67.5\" y=\"-8\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"133.5,0 133.5,-32 186.5,-32 186.5,0 133.5,0\"/>\n<text text-anchor=\"start\" x=\"138.5\" y=\"-13.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10)</text>\n</g>\n<!-- 4&#45;&gt;5 -->\n<g id=\"edge5\" class=\"edge\">\n<title>4&#45;&gt;5</title>\n<path fill=\"none\" stroke=\"black\" d=\"M115.5,-67.84C115.5,-59.89 115.5,-50.66 115.5,-42.26\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119,-42.24 115.5,-32.24 112,-42.24 119,-42.24\"/>\n</g>\n<!-- 7 -->\n<g id=\"node8\" class=\"node\">\n<title>7</title>\n<polygon fill=\"aliceblue\" stroke=\"transparent\" points=\"471,-188 258,-188 258,-146 471,-146 471,-188\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"258.5,-146 258.5,-188 311.5,-188 311.5,-146 258.5,-146\"/>\n<text text-anchor=\"start\" x=\"272.5\" y=\"-170\" font-family=\"Linux libertine\" font-size=\"10.00\">view</text>\n<text text-anchor=\"start\" x=\"263.5\" y=\"-159\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"311.5,-167 311.5,-188 370.5,-188 370.5,-167 311.5,-167\"/>\n<text text-anchor=\"start\" x=\"322.5\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"370.5,-167 370.5,-188 471.5,-188 471.5,-167 370.5,-167\"/>\n<text text-anchor=\"start\" x=\"375.5\" y=\"-175\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 128, 5, 5) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"311.5,-146 311.5,-167 370.5,-167 370.5,-146 311.5,-146\"/>\n<text text-anchor=\"start\" x=\"316.5\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"370.5,-146 370.5,-167 471.5,-167 471.5,-146 370.5,-146\"/>\n<text text-anchor=\"start\" x=\"390.5\" y=\"-154\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3200) </text>\n</g>\n<!-- 6&#45;&gt;7 -->\n<g id=\"edge6\" class=\"edge\">\n<title>6&#45;&gt;7</title>\n<path fill=\"none\" stroke=\"black\" d=\"M364.5,-223.63C364.5,-215.82 364.5,-206.73 364.5,-198.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"368,-198.16 364.5,-188.16 361,-198.16 368,-198.16\"/>\n</g>\n<!-- 8 -->\n<g id=\"node9\" class=\"node\">\n<title>8</title>\n<polygon fill=\"#c1ffc1\" stroke=\"transparent\" points=\"456,-110 273,-110 273,-68 456,-68 456,-110\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"273.5,-68 273.5,-110 326.5,-110 326.5,-68 273.5,-68\"/>\n<text text-anchor=\"start\" x=\"281.5\" y=\"-92\" font-family=\"Linux libertine\" font-size=\"10.00\">Linear</text>\n<text text-anchor=\"start\" x=\"278.5\" y=\"-81\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:1</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"326.5,-89 326.5,-110 385.5,-110 385.5,-89 326.5,-89\"/>\n<text text-anchor=\"start\" x=\"337.5\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">input:</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"385.5,-89 385.5,-110 456.5,-110 456.5,-89 385.5,-89\"/>\n<text text-anchor=\"start\" x=\"390.5\" y=\"-97\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 3200) </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"326.5,-68 326.5,-89 385.5,-89 385.5,-68 326.5,-68\"/>\n<text text-anchor=\"start\" x=\"331.5\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">output: </text>\n<polygon fill=\"none\" stroke=\"black\" points=\"385.5,-68 385.5,-89 456.5,-89 456.5,-68 385.5,-68\"/>\n<text text-anchor=\"start\" x=\"396.5\" y=\"-76\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10) </text>\n</g>\n<!-- 7&#45;&gt;8 -->\n<g id=\"edge7\" class=\"edge\">\n<title>7&#45;&gt;8</title>\n<path fill=\"none\" stroke=\"black\" d=\"M364.5,-145.63C364.5,-137.82 364.5,-128.73 364.5,-120.18\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"368,-120.16 364.5,-110.16 361,-120.16 368,-120.16\"/>\n</g>\n<!-- 9 -->\n<g id=\"node10\" class=\"node\">\n<title>9</title>\n<polygon fill=\"lightyellow\" stroke=\"transparent\" points=\"435.5,-32 293.5,-32 293.5,0 435.5,0 435.5,-32\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"293.5,0 293.5,-32 382.5,-32 382.5,0 293.5,0\"/>\n<text text-anchor=\"start\" x=\"298.5\" y=\"-19\" font-family=\"Linux libertine\" font-size=\"10.00\">output&#45;tensor</text>\n<text text-anchor=\"start\" x=\"316.5\" y=\"-8\" font-family=\"Linux libertine\" font-size=\"10.00\">depth:0</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"382.5,0 382.5,-32 435.5,-32 435.5,0 382.5,0\"/>\n<text text-anchor=\"start\" x=\"387.5\" y=\"-13.5\" font-family=\"Linux libertine\" font-size=\"10.00\">(1, 10)</text>\n</g>\n<!-- 8&#45;&gt;9 -->\n<g id=\"edge8\" class=\"edge\">\n<title>8&#45;&gt;9</title>\n<path fill=\"none\" stroke=\"black\" d=\"M364.5,-67.84C364.5,-59.89 364.5,-50.66 364.5,-42.26\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"368,-42.24 364.5,-32.24 361,-42.24 368,-42.24\"/>\n</g>\n</g>\n</svg>\n",
"text/plain": [
"<graphviz.graphs.Digraph at 0x79874fe30980>"
]
},
"metadata": {},
"execution_count": 27
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment